Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is DateTime.MinValue 0001-01-01T00:00 instead of 0000-01-01T00:00?

Why in .NET DateTime.MinValue is 0001-01-01T00:00 instead of 0000-01-01T00:00? I think that 0 year should be totally valid, as DateTime is conceptually is still interval after some event (like the birth of Jesus).

It seems that with current DateTime implementation it's not possible to track some date at the same year when Jesus has born.

I know this is just a theoretical question, but it's interesting to know if there are any actual reasons, why year = 0000 is not used.

like image 675
Lashas Avatar asked Sep 08 '15 11:09

Lashas


1 Answers

Year zero does not exist in the traditional Proleptic Gregorian calendar. 31st December 1 BCE is followed by 1st January 1 CE.

DateTimes are represented internally as ticks since the start of the Gregorian Calendar's Common Era. You can create a DateTime with other Calendars if you wish.

The DateTime value type represents dates and times with values ranging from 00:00:00 (midnight), January 1, 0001 Anno Domini (Common Era) through 11:59:59 P.M., December 31, 9999 A.D. (C.E.) in the Gregorian calendar. Time values are measured in 100-nanosecond units called ticks, and a particular date is the number of ticks since 12:00 midnight, January 1, 0001 A.D. (C.E.) in the GregorianCalendar calendar (excluding ticks that would be added by leap seconds). For example, a ticks value of 31241376000000000L represents the date, Friday, January 01, 0100 12:00:00 midnight. A DateTime value is always expressed in the context of an explicit or default calendar. -- https://msdn.microsoft.com/en-us/library/system.datetime(v=vs.110).aspx

ISO 8601, however, does have a year Zero, but that refers to 1BCE in the Gregorian calendar. See: https://en.wikipedia.org/wiki/ISO_8601#Years

like image 162
Colin Mackay Avatar answered Nov 18 '22 05:11

Colin Mackay