Understanding and Using Julian Dates

screenshot moderate.gifscreenshot tip12.gif

Get to know and use Julian Dates.


Date-based searching good! Date-based searching with Julian dates annoying (for a human, anyway)!

The Julian date is the number of days that have passed since January 1, 4713 BC. Unlike Gregorian dates,
which begin at midnight, Julian days begin at noon, making them useful for astronomers.

A Julian date is just one number. It's not broken up into month, day, and year. That makes it problematic for humans but handy for computer programming, because to change dates, you simply have to add and subtract from one number, and not worry about month and year changes.

To use Google's date-range syntax in Perl, you'll need a way to convert the computer's local time to Julian. You can use the module Time::JulianDay, which offers a variety of ways to manipulate local time in Julian format. You can get the module and more information at http://search.cpan.org/search?query=Time%3A%3AJulianDay.

s that use the Julian date format and date-range searching pop up throughout this tutorial; start by learning more about using the date-range syntax [Tip #11]. Also included are tips for building recent searches into a customized form [Tip #42], and date-range searches with a client-side application [Tip #60].