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

266
Views
How to get utc datetime based on user's current datetime in js?

I try to get datetime based on user's current datetime. For example, if I want to get the start of the current date in utc,

const start = new Date()
start.setUTCHours(0,0,0,0)

if I want to get the end of the current date in utc,

const end = new Date()
end.setUTCHours(23,59,59,999)

but when I console.log start, it's

Sun Jun 05 2022 17:00:00 GMT-0700 (Pacific Daylight Time)

May I know why there's this "(Pacific Daylight Time)"? )

So what if I want to get 5 days ago of current datetimt? Like if now local datetime is 2:35pm pst, how do I get 5 days ago 2:35 pm but in utc (which should be 7:35pm right?) Thanks!

about 4 years ago · Juan Pablo Isaza
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!