How to store old dates in SharePoint?

I need to save dates in SharePoint, which should return around 5000 BC. Ideally, I would like to be able to do date addition / subtraction as follows:

oldDate = '5000 BC'; newDate = '1995 AD'; DateDiff(oldDate, newDate, 'Years'); // equals 6995 

How do I proceed? Build an old_date class based on strings? Just use regular dates, but add AD or BC, what makes the date negative?

+4
source share
3 answers

I ended up storing dates in a text box in ISO 8601 format:
YYYY-MM-DDThh:mm:ss.sTZD

You do not need to store the entire line, for example, if you want to save 5000 BC, you must enter -5000-01-01 . I don’t get the addition and subtraction of the date very easy, but it was much easier to get the data there in the format I wanted.

0
source

This is a serious non-trivial problem and really depends on what exactly you want to do with these dates. For example, we used only the current (Gregorian) calendar from 1582. Before that, it was the Julian calendar, and before that the old Roman calendar. Even worse, this information is valid only for Western Europe (and culturally-related areas). Therefore, if you are hoping to get something that will give you the correct accepted dates for historical events with a little simple math, you will be in great disappointment.

If you just want to run the Gregorian calendar in the opposite direction, I believe this is doable. However, there is still an error, in which case it matters. Material from Wikipedia:

By the times of thousands of years, the Gregorian calendar lags behind the seasons because the Earth's rotation slows down every day a little longer (see tidal acceleration and leap per second), while the year maintains a more uniform duration

+5
source

If you are only interested in years, not days, you can create your own field with a custom editor and save the year value as an integer value.

Values ​​less than zero are equal to the average value of BC and values ​​greater than or equal to zero, the average value of AD.

+2
source

All Articles