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

234
Views
date-fns format time in 24 hour format

I'm using date-fns in a React project.

const sampleText = 'Tue Aug 03 2021 18:49:11 GMT+0800';
const sampleDate = new Date(sampleText);
format(sampleDate, 'hh:mm')

This returns '06:49'. How can I get this to return '18:49' instead?

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

0

The format tokens for date-fns can be found here: https://date-fns.org/v2.28.0/docs/format

const sampleText = 'Tue Aug 03 2021 18:49:11 GMT+0800';
const sampleDate = new Date(sampleText);
format(sampleDate, 'HH:mm')
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!