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

147
Views
Formatee la fecha JSON para dsilay en html

Tengo un JSON que devuelve una fecha simple que estoy colocando en un DIV...

 let movieDate = data.release_date; document.getElementById('movie-date').innerHTML = movieDate;

La salida se devuelve así...

 2021-07-14

Necesito cambiar esta salida para que se muestre en dos formatos diferentes...

  • 14 junio 2021
  • 2021

¿Hay una manera simple de hacer esto?

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

0

Probablemente lo más fácil sea usar una biblioteca de terceros como day.js.

Sin embargo, se puede lograr mediante:

 const date = new Date('2021-07-14') const monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] // "14 July 2021" const sDate = `${date.getDate()} ${monthNames[date.getMonth()]} ${date.getFullYear()}` console.log(sDate) // 2021 console.log(date.getFullYear())

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!