Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

125
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!