Using the daterange Google Advanced Search Syntax Operator : 5ubliminal's TellinYa

<a href="http://www.tellinya.com/art2/117/">Using the daterange Google Advanced Search Syntax Operator : 5ubliminal's TellinYa</a>
Must Reads: Web Scraping | Link Farming | Code Snippets | SEO Freeware
Reveal More!
Google Advanced Search Operator: Daterange

This parameter, not too often used, works like this: append it to your search and you will get results added or updated in that date range. It consits of 2 julian dates that represent the days between which you wish to see the `news`. This way you can see how many pages google updates / adds daily on your site and this way find some hints on popularity of pages.

I'm not expert at explaining and an example would work best:

site:www.tellinya.com daterange:2454341-2454348

Previous google search will show all pages that had a piece of action between 28 August 2007 - 04 September 2007.

PHP covers Time to Julian Date conversion and you can read that to understand more but you can also use the code below to generate the search prefix for a daterange as you wish.

PHP Script to Generate the data range

<?
// --
// Notice function has no declared parameters and
// will generate notices and warnings! Below you'll
// see how to use this and disable the warnings!
// --
function googleDateRange(){
    
$argc func_num_args();
    if(!
$argc// We do this for current day
        
return "daterange:".unixtojd(time())."-".unixtojd(time());
    if(
$argc == 1// We have a number of days ago
        
return "daterange:".unixtojd(time()-(func_get_arg(0)*24*3600))."-".unixtojd(time());
    if(
$argc == 2// We have two time stamps
        
return "daterange:".unixtojd(func_get_arg(0))."-".unixtojd(func_get_arg(1));
    return 
false;
}
// --
?>

How to use it in real life

<?
// --
// Turn of NOTICE and WARNING reporting as this function has no parameters declared
// and the warnings will flood you!
error_reporting(E_ALL ^ (E_WARNING|E_NOTICE));
// --
// Get a date range for today
echo googleDateRange();
// Get a date range for last 5 days
echo googleDateRange(5);
// Get a date range between 14days ago and 7days ago
echo googleDateRange(time()-(14*24*3600),time()-(7*24*3600));
// --
?>

Last but not least …

You could combine this with previous tutorial on Scraping Google Search Results educational script and have a blast!

Post Feedback 
Name *
Mail *
URL
« Anti-Spam
» URL will only go live after a review. Comments are moderated. «
5ubliminal's TellinYa.com SEO & SEM Blog © 2007 - All rights reserved unless mentioned otherwise .
Rendered On : [Sunday, 06 July, 2008 - 04:17:04 GMT]   No Ajax / Flash Used Here
" Using the daterange Google Advanced Search Syntax Operator : 5ubliminal's TellinYa "