O'Reilly Hacks
oreilly.comO'Reilly NetworkSafari BookshelfConferences Sign In/My Account | View Cart   
Book List Learning Lab PDFs O'Reilly Gear Newsletters Press Room Jobs  

Google date range bookmarklet
Adds a daterange to your Google search criteria and submits search. Prompts for days back, defaulting to 30 days back from today.

Contributed by:
David Crossman
[03/06/04 | Discuss (1) | Link to this hack]

Google supports several search enhancements through special syntaxes (See Google Hacks). One of these allows searching on Google indexing dates:

      daterange:<julian date>-<julian date>

This hack consists of a bookmarklet that inserts a daterange into your Google query (replacing an existing daterange, if necessary) and then submits the query. It prompts for the number of days back (from the current day), defaulting to 30. If the input contains a second number, then the datarange is days back from that number of days before the current day. For instance, the input "30 60" would search on the range from 90 to 60 days before the current day. (Today, 6 Mar 2004, it produces " daterange:2452979-2453009".)

Install the hack in your browser by dragging this link gglDays to the browser's Links/Personal Toolbar.

Here is the code:

if(!!(p=prompt('Days back','30 '))&&!!(p=p.match(/\d+/g))){
	t=new Date();
	d=' daterange:';
		f[0].q.value=f[0].q.value.replace(new RegExp(d+'\\d+-\\d+'),'');
	} else

O'Reilly Home | Privacy Policy

© 2007 O'Reilly Media, Inc.
Website: | Customer Service: | Book issues:

All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners.