Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

119
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda