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

185
Vistas
String datetime JS Date obj

I am trying to convert a datetime string to JS date obj. My Input is 2021-09-16 19:15:52.930. The problem is this string doesn't have a timezone, And I need to mark them in cdt/cst(depending on daylight savings) timezone when converting to JS date obj.

The way I am trying to do is:

let dt = new Date('2021-09-16 19:15:52.930 Timezone')

I could pass CDT or CST in placeof timezone, to get it parsed. But in this case, my logic needs to know which timezone is currently being followed depending on time in year. I wanted a way so that it can be handled automatically by JS, Like- passing CT? 2021-09-16 19:15:52.930 CT But this doesn't seem to be supported by Date().

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

0

If you don't pass anything and use it like this,

new Date('2021-09-16 19:15:52.930')

JS will consider it as your machine's timezone.

If you want it as UTC, add the letter Z like this,

new Date('2021-09-16 19:15:52.930Z')

If you want a specific timezone, add the time difference from UTC. For CDT it is -5:00,

new Date('2021-09-16 19:15:52.930-05:00')
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