I have MySQL DB, and I need to be able to store dates before 1970, so I need my own way of storing dates. In my case, I need to be able to store dates to date and even in history. Obviously, earlier events in history require less accuracy - days, months, even years become less important, since we do not have this historical information. The main query related to dates will be the selection of records between two given dates.
I thought to use this format:
Year - int(6) | Month - tinyint(2) | day - tinyint (2) | time - time | AD tinyint (1) | mya - int (11)
But when it comes to the actual use of data in this format, it becomes difficult. For example, if I want to get all records between two dates, it will be similar (pseudocode, not SQL):
get all where
year between minYear and maxYear
if year == minYear, month >= minMonth
if year == maxYear, month <= maxMonth
if month == minMonth, day >= minDay
if month == maxMonth, day <= maxDay
if day == minDay, time >= minTime
if day == maxDay, time <= maxTime
-, . / 0 AD, ! 2011 = 6,4 0 AD. - ?