Nulife4mee Blog

Excerpt from Google Hacks Book (Hack #12)

Posted by: Professional Writer on: February 15, 2010

Excerpt from Google Hacks Book (Hack #12)

Google Hacks Book

Google Hack #12 – Get to know and use Julian Dates.

Date-based searching is good!  Date-based searching with Julian Dates is annoying. (For humans 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 dates is just one number.  It is 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 info 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]

End of Google Hacks Book Excerpt

Advertisement

  • None
  • Mr WordPress: Hi, this is a comment.To delete a comment, just log in, and view the posts' comments, there you will have the option to edit or delete them.

Categories

Follow

Get every new post delivered to your Inbox.