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

91
Views
Passing a date through props from UTC to local

I'm trying to pass this props.data.STDout which is a string in this format "2022-04-29 14:05:00" from UTC to local time.

I've tried but it doesn't work, do you have any ideas?

let newDate = new Date(props.data.STDout);
let newDate2 = newDate.toString()

Thank you very much!

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Try let newDate2 = newDate.toLocaleString()

about 4 years ago · Juan Pablo Isaza Report

0

I got it!

Just needed to add UTC to the original date string, so this is how it looks working perfectly:

let newDate = new Date(`${props.data.STDOut} UTC`);
let newDate2 = newDate.toString();

As props.data.STDOut is a string you should use the literal `${}` to wrap it and be able to add UTC to it, then just parse toString, and done. It might be a more elegant solution, but for now, if it works, it works.

Thanks guys!

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!