Created
June 14, 2011 11:03
-
-
Save feedhenry-gists/1024689 to your computer and use it in GitHub Desktop.
Current Date/Time Cache Current Time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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