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

185
Vistas
How to set a date string to a the following format

I'm using javascript and trying to convert a string to a different format. I did some research on this format but no one has asked about it yet so I thought I may ask. So I have seen that others want to convert a date string that has a shorter length. But this format is different. The format I have now by doing this:

    const now = new Date();
    const currentDate = now.toISOString();

I get this number:

2021-12-05T07:52:47.485Z

However, I want to make it the format like this:

2021-12-05T00:00:00.000+00:00

Is there any way to do so? I don't see others asking about this so not sure if possible

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

0

Use moment library:

<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.17.1/moment.min.js"></script>    

Like this:

var now = new Date();
now.setHours(0,0,0,0);
var format = 'YYYY-MM-DD[T]HH:mm:ss.SSS[+00:00]';
console.log(moment(now).format(format));

Link: https://codepen.io/sdssz1365/pen/rNGORKR

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