Wednesday, April 18, 2007

TimeZones in JavaScript

If you want to obtain the user's timezone offset in JavaScript (that is, the difference between their timezone and Greenwich Mean Time, or GMT), use this snippet:

(new Date().getTimezoneOffset()/60)*(-1)

No comments: