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

234
Vistas
How to format date in a system date format using Angular

I want to convert the date into a system date format. For Example, if the system date format is DD-MM-YYYY, then my web application should show 30-11-2021, and on another system, if the date format is MM-DD-YYYY, then it should show 11-30-2021. Basically, it should convert to the date format of the client's system.

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

0

You can do it like this.

function formatDate(d: Date): string {

  let lang: string;
  if (navigator.languages != undefined) {
    lang = navigator.languages[0]; 
  } else {
    lang = navigator.language;
  }

  const options: DateTimeFormatOptions = {
    year: 'numeric',
    month: '2-digit',
    day: '2-digit',
  };

  return new Intl.DateTimeFormat(lang, options).format(d);
}
    
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