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

130
Views
Display Date in time zone specified in date string

I have this date coming as string from API

{
 "date": "2020-11-05T18:24:00-05:00"
}

I want this to be rendered as :

November 5, 2020, 6:24:00 PM EST

The issue is, I can't extract timezone name from this string to pass to Intl.DateTimeFormat()

Any thoughts?!

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

0

You can't get EST from -05:00 directly, without defining a context. Indeed, this offset could reference several time zones, see this list.

In the browser, you can let the time library to guess the time zone of your client:

var tz = moment.tz.guess(); // America/New_York, for example
var date = moment("2020-11-05T18:24:00-05:00").tz(tz)
   .format("MMMM D, YYYY, h:mm:ss A z");
console.log(date);    // November 5, 2020, 6:24:00 PM EST

Or you can define a time zone yourself.

Of course, the two solutions will not give you the same result depending on the time zone specified.

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!