Skip to content

Instantly share code, notes, and snippets.

@amitpatelx
Created April 5, 2012 11:23
Show Gist options
  • Save amitpatelx/2310060 to your computer and use it in GitHub Desktop.
Save amitpatelx/2310060 to your computer and use it in GitHub Desktop.
Get timezone offset in browser using javascript
function getTimezone(){
var current_date_time = new Date();
currentTimeZoneOffsetInHours = (-1) * current_date_time.getTimezoneOffset()/60;
return currentTimeZoneOffsetInHours;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment