Getting Midnight Time for DateTime

Presumably easy thing to do. How to get only date for DateTime? DateTime.Now! Well... Not Quite, because it returns the time as well. Fortunately, we don't have to design any algorithms to do do it for us. It turns out that DateTime struct also contains Today attribute which returns current day without returning the current time.

There is also another way of doing it. We can use DateTime.Now.Date.

Leave Comment

Your email address will not be published.

Please type the characters of this captcha image in the input box

Please type the characters of this captcha image in the input box