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

158
Views
Obtener la fecha y la hora UTC por Fecha y hora Nombre de la zona

Necesito una función para obtener la fecha y hora UTC. Pasé solo la fecha, la hora y el nombre de la zona horaria. Necesito obtener la hora y la fecha UTC. Gracias

Ex:

 const utcDate = getUTCDateTime("2022-05-10","18:00" "America/Hermosillo"); // OutPut should be like this ==>> 2022-05-11T01:00:00.527Z function getUTCDateTime(date,time, timeZoneName){ //Logic return utcDate; }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Usaría una biblioteca como Day.js para este propósito. Puede analizar la fecha y la hora en una zona horaria, convertir a UTC y luego mostrar en el formato deseado.

 dayjs.extend(utc); dayjs.extend(timezone); dayjs.extend(customParseFormat); function getUTCDateTime(date, time, timeZoneName) { const utcDate = dayjs .tz(`${date} ${time}`, "YYYY-MM-DD HH:mm", timeZoneName) .utc() .format("YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"); return utcDate; }
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!