0

Api response :

checkIn: "2021-08-30 03:45:00"

dstOffSet: 3600 
rawOffSet: -28800 
shortName: "PDT" 
timezone: "America/Los_Angeles" 
timezoneDisplayName: "Pacific Standard Time" 
timezoneId: 0 
zipCode: "94103" 

I need to convert this checkin date in America/Los_Angeles time zone.

Any one please help

Alireza Ahmadi
  • 8,579
  • 5
  • 15
  • 42
vims
  • 1
  • 1
  • 1
    Does this answer your question? [Convert date to another timezone in JavaScript](https://stackoverflow.com/questions/10087819/convert-date-to-another-timezone-in-javascript) – Dương Tiểu Đồng Aug 30 '21 at 05:26
  • I think this is the same question... https://stackoverflow.com/questions/10087819/convert-date-to-another-timezone-in-javascript – Parth Raval Aug 30 '21 at 05:28

1 Answers1

0

Use toLocaleString like this:

var result = new Date(new Date("2021-08-30 03:45:00")).toLocaleString("en-US", {timeZone: "America/Los_Angeles"}); 

console.log(result);
Alireza Ahmadi
  • 8,579
  • 5
  • 15
  • 42