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

141
Views
How to format a date to always show as UTC

I am trying to format a date such that it always shows as UTC e.g. in the format 'dd/mm/YYYY HH:MM UTC'. So far I have this code:

const options = {
    year: 'numeric',
    month: 'numeric',
    day: 'numeric',
    hour: 'numeric',
    minute: 'numeric',
    timezone: 'UTC',
    timeZoneName: 'short'
};

const formattedTime = new Intl.DateTimeFormat('en-GB', options).format(new Date(unixTimestamp))

However this gives me a time in either GMT or BST, e.g.

24/11/2021, 05:51 GMT
27/10/2021, 05:09 BST

What I would like is for the time to be always shown as UTC so in the case of the above examples:

24/11/2021, 05:51 UTC
27/10/2021, 04:09 UTC

Is there a way to configure DateTimeFormat to do this or should I be using something else? I'd rather not resort to importing a library if at all possible.

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

0

The timezone property of the formatting options object must be in camelCase - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/DateTimeFormat#timezone

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!