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

117
Visualizações
Formatting date in Javascript for Sitemap

I am working with a sitemap where the modified date that is being pulled from WP GraphQL is incorrectly formatted which looks like 2021-11-24T17:03:44.597Z. Looking at Google's recommendations it suggests something like: 2021-11-24T16:02:05+00:00

Is there an efficient way of converting this to the recommended format?

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

You can use the momentjs library and use the following to convert your date:

moment(value).utc().format("LLL");

Or

moment(value).utc().format("M/D/YY");

Also, you can check the official documentation, it is very good and flexible for different kinds of date conversions.

As commented @Rawley Fowler you can use DayJs is recommended by momentJS team and is a lighter and more modern version to do those kind of conversions, to do it with that library you can use:

dayjs(value).utc().format('DD/MM/YYYY') // '25/01/2019'

Or

dayjs(value).utc().format('LLL') // 'January 25, 2019 8:02 PM'

This depends on what kind of format you need.

about 4 years ago · Juan Pablo Isaza Relatório

0

How to convert yyyy-mm-dd't'hh:mm:ssZ to normal time javascript?

This should answer your question, just create a const date = new Date('2021-11-24T17:03:44.597Z') and then you can date.getDate(), date.getMonth() etc to format it in a way you need.

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