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

81
Views
convertir js datetime a momento

Tengo este formato de fecha y hora actualmente almacenado en res.data[i].time :

 2022-05-18T13:00:00.000Z

lo que quiero hacer es convertirlo a formato de moment . Cuando hago esto:

 moment().toDate()

me da esto:

 Tue May 10 2022 13:00:00 GMT-0400 (Eastern Daylight Saving Time)

lo que quiero hacer es convertir 2022-05-18T13:00:00.000Z a momento de alguna manera. Lo intenté:

 moment().toDate(res.data[i].time)

pero eso tampoco funciona. ¿Hay alguna forma de hacer esto?

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

0

Si quieres usar momentjs en cualquier etiqueta

 <h3>{{ moment(res.data[i].time).format("DD.MM.YYYY") }}</h3>

y vuelve a usted (aproximadamente la fecha de hoy)

 11.05.2022

para familiarizarse con los formatos detallados:

momentJs todos los formatos

about 4 years ago · Juan Pablo Isaza Report

0

Simplemente let whatever = moment(res.data[i].time) debe instanciar el objeto de moment con la cadena de tiempo proporcionada. Luego puedes hacer lo que necesites desde allí.

about 4 years ago · Juan Pablo Isaza Report

0

Esto es lo que admite Moment ahora.

 moment("2010-10-20 4:30 +0000", "YYYY-MM-DD HH:mm Z"); // parsed as 4:30 UTC moment('24/12/2019 09:15:00', "DD MM YYYY hh:mm:ss"); moment('24/12/2019 09:15:00', "DD MM YYYY hh:mm:ss", true); . . .

Ver este documento -> https://momentjs.com/docs/

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!