Created
March 16, 2015 02:56
-
-
Save treevis/90a5432b33ba8acc11fe to your computer and use it in GitHub Desktop.
Get User's Timezone
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
<!DOCTYPE html> | |
<html lang="en-us"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Set timezone</title> | |
</head> | |
<body> | |
<!-- http://pellepim.bitbucket.org/jstz/ --> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/jstimezonedetect/1.0.4/jstz.min.js"></script> | |
<script> | |
var tz = jstz.determine(), | |
tz_name = 'UTC'; | |
if(typeof(tz) !== 'undefined') { | |
tz_name = tz.name(); | |
} | |
document.cookie = 'timezone=' + tz_name + ';path=/'; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment