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

485
Visualizações
is javascript new Date() created at same time on 2 diff machines/timezones exactly same?

I wanted to know if a date object created at any point of time differ based on time zones or not. I tried this by executing new Date().getTime() once for IST and immediately again by setting my PC time zone to GMT. The resultant values are:

  • IST - 1633334780053
  • GMT - 1633334788831

A difference of around 8000 milliseconds

From this it seems that datetime objects created at same moment are exactly same no matter in which time zone they are created. Please suggest if this understanding is correct or is there more to it.

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

You're right. Two different date time objects created at the same point of time are same no matter the time zone.

They can be formatted to their corresponding timezone representation using javascript.

One important thing to be noted is that the date time object created uses the system's date time configuration to find the correct time. If the system's date and time configurations are correct and in sync, then the date time object created in the browser will be correct and will match the system time at the time of creating that object.

about 4 years ago · Juan Pablo Isaza Relatório

0

This is detailed in the JavaScript specification: https://tc39.es/ecma262/#sec-date-objects.

More information is in the MDN docs Date.getTime():

The getTime() method returns the number of milliseconds* since the Unix Epoch.

*JavaScript uses milliseconds as the unit of measurement, whereas Unix Time is in seconds.

getTime() always uses UTC for time representation. For example, a client browser in one timezone, getTime() will be the same as a client browser in any other timezone.

So new Date().getTime() will always return the number of milliseconds since 1970-01-01 00:00:00 UTC, regardless of the client / machine timezone setting.

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