“Obtenga la fecha de fecha actual en JavaScript en formato de 12 horas” Código de respuesta

JS consigue tiempo en AM

var time = new Date();
console.log(
  time.toLocaleString('en-US', { hour: 'numeric', hour12: true })
);  
Exuberant Eel

Obtenga la fecha de fecha actual en JavaScript en formato de 12 horas

//this will give you date object remove the outer new Date to have 
//it as string
const today = new Date(new Date().toLocaleString("en-US", {
    day: '2-digit',
    month: '2-digit',
    year: 'numeric',
    hour: '2-digit',
    minute: '2-digit',
    second: '2-digit',
    hour12: true
}));
sandy_codes_py

Respuestas similares a “Obtenga la fecha de fecha actual en JavaScript en formato de 12 horas”

Preguntas similares a “Obtenga la fecha de fecha actual en JavaScript en formato de 12 horas”

Más respuestas relacionadas con “Obtenga la fecha de fecha actual en JavaScript en formato de 12 horas” en JavaScript

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código