If given a date in UTC (let's say) is it possible to convert to various time zones taking DST into account?
I'm interested if JS can do this natively, without me having a list of time zones and their offset.
Thanks.
If given a date in UTC (let's say) is it possible to convert to various time zones taking DST into account?
I'm interested if JS can do this natively, without me having a list of time zones and their offset.
Thanks.
A date (in Javascript and in most other systems) is not "in" a particular timezone. It measures the number of milliseconds between midnight, January 1, 1970 GMT, and "now".
Timezone only comes into play when you want to convert it to or from a human-readable format.
You can use the getTimezoneOffset method.