Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

214
Vistas
How to Convert Timestamp to more readable Time with String

So I'm using Timestamps in Mongoose but the format is this: 2021-12-09T08:35:44.189Z, but I don't want to show this way, instead what I want is: 9 December 2021.

What is the approach to it? as I haven't found any.

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

If you will do it by your self , first you can use new Date("2021-12-09T08:35:44.189Z") to get the timeStemp of this date ,and then , use the api: getFullYear、 getMonth、getDate() to get the year、month and date ,then join it by yourself;

let timeStamp = new Date('2021-12-09T08:35:44.189Z');

let year = timeStamp.getFullYear(),
    month = timeStamp.getMonth(),
    date = timeStam.getDate();

or you can also use the third-party like day.js to help you do the same thing

about 4 years ago · Juan Pablo Isaza Denunciar

0

The fastest way is to use moment.js. One-line solution:

console.log(moment('2021-12-09T08:35:44.189Z').format('D MMMM YYYY'));
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment.min.js"></script>

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda