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

127
Vistas
Calculate the client-server UTC offset using EPOC value javascript

We are trying to calculate the client-server time offset by using EPOC value sent from backend API, when doing that I am running into an issue in local browser/client side.

when i get EPOC from backend API I.e. serverEpocValue = 1653107370620 and trying to compare it with the local epoc value the difference is not 6 hours as I expected, it's around few milliseconds difference, why is epoc value close to local time instead of the server time?

const serverdate = new Date(1653107370620)

serverDate = Sat May 21 2022 09:59:30 GMT+0530 (locale browser date and time)

How do we get the server UTC time using epoc to calculate the offset in the client side?

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

0

The time through facilities Date.now() will always be in milliseconds from Jan 1 1970 UTC and does not consider timezones. If you need to get the timezone offset you should use something like Date.getTimezoneOffset

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset

which will return the offset in minutes.

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