Dates from various centuries

So I have a project that deals with creating timelines, etc using dates from various centuries. I can store those in the MySQL database just fine but can’t do any comparing between todays date and the historical dates (such as days since certain events occured). Anyone have any idea on if it’s possible to get the number of days between two dates when one is hundreds of years ago?

(so obviously “strtotime” won’t work)

What is the exact format of the dates in your database? Can you show an example of one?

just in regular ‘date’ format: ‘1500-05-22’

run this and see what you get –


SELECT DATEDIFF(CURRENT_DATE,'1500-05-22') AS diff

Duh…got it. I kept thinking of doing it with php instead of MySQL. Perfect. Thanks.

Great, this is one page you should study http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html