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

157
Views
javascript timezone conversion using momentjs

I have a date and time in UTC and a timezone I want to convert this date and time to the given timezone equivalent e.g. if UTC date is 2022-01-10T00:00:00.000Z that means 10 Jan 00:00 am and when I convert it to NewYork timezone equivalent output should be given as 2022-01-09T19:00:00.000Z that is 9 Jan 07:00 pm or 19:00 because it has -05:00 hour from UTC. how I can achieve that can anyone help? timezone can be any timezone. Thanks for your help.

like 
let date= '2022-01-10T00:00:00.000Z';
let timezone = 'America/New_York';
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can use moment-timezone like this:

const moment = require('moment-timezone')

const date = '2022-01-10T00:00:00.000Z';
const timezone = 'America/New_York';

const convertedDate = moment.utc(date)  // create Moment object from date in UTC
  .tz(timezone)                        // convert to provided time zone
  .format('YYYY-MM-DD hh:mm:ss A')    // display in format

console.log(convertedDate)
// 2022-01-09 07:00:00 PM
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!