Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

146
Views
Why JavaScript returns different time when we use TimeZone vs + sign in the String

I want to parse a string date time to a JavaScript Date object. I'm wondering why using +Number in the string gives me different result from using (TimeZome)

Example:

let a = new Date('Nov 01, 2022 09:00:00 +0900')
let b = new Date('2022-11-01T09:00:00.000+09:00')
let c = new Date('01 Nov 2022 09:00:00 (JST)')
let d = new Date('Nov 01, 2022 09:00:00 (JST)')

console.log(`${a.getTime()}    ${a.toISOString()}   ${a.toLocaleString('en-us', { timeZone: 'JST' })}`);
console.log(`${b.getTime()}    ${b.toISOString()}   ${b.toLocaleString('en-us', { timeZone: 'JST' })}`);
console.log(`${c.getTime()}    ${c.toISOString()}   ${c.toLocaleString('en-us', { timeZone: 'JST' })}`);
console.log(`${d.getTime()}    ${d.toISOString()}   ${d.toLocaleString('en-us', { timeZone: 'JST' })}`);

the result is

"1667260800000    2022-11-01T00:00:00.000Z   11/1/2022, 9:00:00 AM"
"1667260800000    2022-11-01T00:00:00.000Z   11/1/2022, 9:00:00 AM"
"1667318400000    2022-11-01T16:00:00.000Z   11/2/2022, 1:00:00 AM"
"1667318400000    2022-11-01T16:00:00.000Z   11/2/2022, 1:00:00 AM"

it looks like using (JST) does not generate the correct result!

Note: I get the same result when I use Date.parse

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!