Skip to content

Tag: timezone

MomentJS set timezone without changing time

I’m trying to set the timezone for a date in moment.js without changing the time value I get a date in utc: and I need to set the time zone without changing the time. if I use date.utcOffset(moment().utcOffset()) it adds the offset: I could do but that seems like an inefficient way to do it. Is there an…

Convert date to another timezone in JavaScript

I am looking for a function to convert date in one timezone to another. It need two parameters, date (in format “2012/04/10 10:10:30 +0000”) timezone string (“Asia/Jakarta”) The timezone string is described in http://en.wikipedia.org/wiki/Zone.tab Is there an easy way to do this? Answe…

Convert UTC date time to local date time

From the server I get a datetime variable in this format: 6/29/2011 4:52:48 PM and it is in UTC time. I want to convert it to the current user’s browser time zone using JavaScript. How this can be done using JavaScript or jQuery? Answer Append ‘UTC’ to the string before converting it to a date in …

Getting the client’s time zone (and offset) in JavaScript

How can I gather the visitor’s time zone information? I need both: the time zone (for example, Europe/London) and the offset from UTC or GMT (for example, UTC+01) Answer Using getTimezoneOffset() You can get the time zone offset in minutes like this: The time-zone offset is the difference, in minutes, b…