yigal
yigal

Reputation: 4725

how to convert unix timestamp to date+time for a given timzone

In JavaScript, I have unix timestamp, how do i convert it to data+time for any given timezone, regardless of the local timezone? I am especially interested in US/eastern

Upvotes: 1

Views: 38

Answers (1)

R3tep
R3tep

Reputation: 12864

You can use the property .toLocaleString and set the desired timeZone

const unixTimestamp = 1548979200000; 
new Date(unixTimestamp).toLocaleString("en-US", {timeZone: "US/Eastern"})

Upvotes: 2

Related Questions