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.
Hacks that use the Julian date format and date-range searching pop up throughout this book; start by learning more about using the date-range syntax [Hack #11]. Also included are hacks for building recent searches into a customized form [Hack #42], and date-range searches with a client-side application [Hack #60].
Get Google Hacks now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.