DateTime.Today , beginning or end of the day?

I am using DateTime.Today.

Now I'm not sure if the date is from the beginning of the day or the end of the day.

This is what DateTime.Today returns : {11-3-2014 0:00:00}


MSDN states the following: "An object that is set to today's date, with the time component set to 00:00:00."

This means that a DateTime object is created with today's date at the absolute start of the day hence 00:00:00.

You can check if it is the start of the day by using the AddHour() method of the DateTime class.

DateTime d = DateTime.Today;
//AddHours, AddMinutes or AddSeconds
d = d.AddHours(1);
if (d.Date != DateTime.Today.Date) 
   //Not the same day

If should be different the date was initialised at a different time (eg. 23:00:01).

Thats the beginning of the day, the end of the day would be:

{11-3-2014 23:59:59}

And remember, the only stupid question is the one you don't ask :)

0:00:00 is the start of the day and 23:59:59 is the end of day.

You can also confirm through this 24-hour clock

In the 24-hour time notation, the day begins at midnight, 00:00, and the last minute of the day begins at 23:59. Where convenient, the notation 24:00 may also be used to refer to midnight at the end of a given date[5] – that is, 24:00 of one day is the same time as 00:00 of the following day.

On a side note:-

If you want to know the time then use .Now because that includes the 10:32:32 or whatever time; however .Today is the date-part only (at 00:00:00 on that day ie the begining of the day). So you can say that .Today is essentially the same as .Now.Date

DateTime.Today returns the current DateTime value, without the Time part.

Which means, it is the the first possible DateTime value for the current day.

Think of it like this:

The last moment in a day can be 23:59 or theoretically any amount of nanseconds before the next day. the next day then starts at 00:00:00 counting upwards.

So 11-3-2014 0:00:00 marks the beginning of a day. Either the earliest possible moment, or no time at all, if you want to treat 0:00:00 as a default value.

Need Your Help

Assign an array literal to a variable in Liquid Template

jekyll liquid

The only way i know to create an array from my liquid template is:

Triangle Collision with Rectangle/Circle in LibGDX

java libgdx

Does anyone have any suggestions on the best way to handle triangle intersections with rectangles and circles in LibGDX? I see the Intersector class has methods for testing intersections with trian...