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

113
Views
Typescript date not the same

I just want to know why these two dates in ISO format are not the same.

const d1 = '2022-08-04T08:16:32.716904'
const d2 = '2022-08-04T08:16:32.716Z'

console.log(new Date(d1).toLocaleString())
// "04/08/2022, 08:16:32"
console.log(new Date(d2).toLocaleString())
// "04/08/2022, 10:16:32"

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

The Z stands for the Zero timezone, as it is offset by 0 from the Coordinated Universal Time (UTC).

Source: https://stackoverflow.com/a/29282022/11659853

This means the two Date objects have different time zones. The other Date object probably has your local time zone.

about 4 years ago · Juan Pablo Isaza Report

0

The timezone of of d1 is not the same of the timezone of d2. d2 is in Zulu (UTC) while d1 is given in your local timezone since the timezone info was not provided in the datestring.

Notice d2 has a Z letter after the time. d1 misses this.

You can look up more info about ISO datestrings and their timezone offset here: https://en.wikipedia.org/wiki/ISO_8601

about 4 years ago · Juan Pablo Isaza Report
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!