I maintain a PHP/Flash app that uses Julian dates within the code and only converts to Gregorian for display. Before I replace the integer Julian dates with a Date data-type I was wondering if there was a benefit to using the Julian? Should this even be changed?
One of the problems is being able to quickly look at dates in the database. I added a Date-Time Stamp to one of the tables to correct this but now we are moving to a new DB and have the opportunity to make improvements so moving away from the Julian date seems like the thing to do. So why would I not want to do this? The original developer is no longer here.
For date/time management, you want all your instants to use a simple, monotonous, linear scale. Human calendars, time zones, daylight saving time, these make things more complex and are best kept in the display layer.
A common scale is to encode instants as a number of seconds (or milliseconds) since a specific origin. In Java, you would use milliseconds since January 1st, 1970, at 00:00:00 UTC (also known as "the Epoch"); you would also ignore leap seconds, so that conversions to any date and time in any calendar are purely algorithmic. That scale is what System.currentTimeMillis()
returns. In a Unix world, you may use the number of seconds since the Epoch, since this is what the Unix kernel is prone to return (through the time()
system call).
Such linear scales make it easy to compare dates and compute time intervals, while anything calendar-based makes such computations more difficult.
So my advice would be to move away from Julian dates, but certainly not to convert them to Gregorian dates. Quite the opposite, actually.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With