Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

184
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda