Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

217
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda