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

238
Vistas
Convert string(Date(1646764200000+0530)) to date in the format(dd-mm-yyyy) using javascript

I'm Trying to convert the below string to date in the format(dd-mm-yyyy)

let dob = /Date(1646764200000+0530)/

The above value of Date is given in string, How to convert it to date using JavaScript, Tried a lot of methods, but it shows an error as invalid date.?

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

0

Converting to the DD-MM-YYYY requires formatting.

Here is one way to extract the date portion using the slice() method then formatting the output to your desired format. This assumes that the input date is always in the same form and length.

let dob = /Date(1646764200000+0530)/;

let date = new Date(+(""+dob).slice(6,19)).toLocaleString('en-GB',{year:"numeric",day:"2-digit",month:"2-digit"}).split("/").join("-");

console.log(date)

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