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

139
Vistas
DateTime in UTC with toISOString

I have the following code:

console.log(    
  new Date().toISOString()
)  

This returns: 2021-10-14T08:28:28.467Z In my opinion it should return: 2021-10-14T08:28:28.000Z. The difference is the 000Z. In all examples (documentation) I see that it returns 000Z. In my case it doesn't.

How to make sure I also get the 000Z?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

If you set the date yourself, you do get the 0s default if not you get the hh,mm,ss,sss the time has at the time the statement executes –

You have to set the milliseconds if you want 000

Not sure why you would expect 000Z

const d = new Date()
d.setMilliseconds(0)
console.log(d.toISOString())

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