Skip to content

Instantly share code, notes, and snippets.

@feedhenry-gists
Created June 14, 2011 11:03
Show Gist options
  • Save feedhenry-gists/1024689 to your computer and use it in GitHub Desktop.
Save feedhenry-gists/1024689 to your computer and use it in GitHub Desktop.
Current Date/Time Cache Current Time
function getCurrentTimeRegEx() {
var response = $fh.web({
url: 'http://www.timeanddate.com/worldclock/city.html?n=78',
period: 10000, //Cache response for 10 seconds
method: 'GET'
});
// Construct a regular expression to extract the date and time from the response
var reg = /(<strong id=ct[^>]*>)([^<]*)/;
//Extract the required info
var dateMatch = reg.exec(response.body);
return {'date': dateMatch[2]};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment