Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the (best) way to handle dates before Christ in C#/.NET?

Tags:

Is there any built-in support for that? And if not, is there any consensus about handling such dates?


Links to owncoded solutions, or fragments of it, are very welcome.

like image 251
Peter Avatar asked May 18 '09 11:05

Peter


People also ask

How are BC dates determined?

"B.C." stands for "before Christ." The system labels years based on a traditional notion of when Jesus was born — with the "A.D." denoting years after his birth and "B.C." designating the years that predate his birth. In English, it is common for "A.D." to precede the year, so that the translation of "A.D.

When did years start being recorded?

Furthermore, as described in section 2.14, our year reckoning was established by Dionysius Exiguus in the 6th century. Dionysius let the year C.E. 1 start one week after what he believed to be Jesus' birthday.


2 Answers

There is no built in support for dates in this range so you will have to code your own.

Here is an example http://flipbit.co.uk/2009/03/representing-large-ad-and-bc-dates-in-c.html.

like image 127
Adam Ralph Avatar answered Sep 21 '22 19:09

Adam Ralph


If you're referring the handling of DateTime values < DateTime.MinValue, then I think the only "consensus" is to not use System.DateTime to try to represent them.

Any consensus would likely exist only within a community that does work with such dates. What is the area in which you are working? Astronomy?


Whatever the area of interest, there are likely to be others who have experienced this same problem. I'd do some research first, especially if your dates will ever need to interoperate with other software in this same area of interest. Even if you have to code your own, you can at least become aware of the issues that others have had in coding their own.

like image 34
John Saunders Avatar answered Sep 24 '22 19:09

John Saunders