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

187
Views
String datetime JS Date obj

I am trying to convert a datetime string to JS date obj. My Input is 2021-09-16 19:15:52.930. The problem is this string doesn't have a timezone, And I need to mark them in cdt/cst(depending on daylight savings) timezone when converting to JS date obj.

The way I am trying to do is:

let dt = new Date('2021-09-16 19:15:52.930 Timezone')

I could pass CDT or CST in placeof timezone, to get it parsed. But in this case, my logic needs to know which timezone is currently being followed depending on time in year. I wanted a way so that it can be handled automatically by JS, Like- passing CT? 2021-09-16 19:15:52.930 CT But this doesn't seem to be supported by Date().

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

0

If you don't pass anything and use it like this,

new Date('2021-09-16 19:15:52.930')

JS will consider it as your machine's timezone.

If you want it as UTC, add the letter Z like this,

new Date('2021-09-16 19:15:52.930Z')

If you want a specific timezone, add the time difference from UTC. For CDT it is -5:00,

new Date('2021-09-16 19:15:52.930-05:00')
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!