programming-examples/js/Date/Write a JavaScript function to get uppercase Ante meridiem and Post meridiem..js
2019-11-15 12:59:38 +01:00

10 lines
212 B
JavaScript

function upper_am_pm(dt)
{
return dt.getHours() < 12 ? 'AM' : 'PM';
}
dt = new Date();
console.log(upper_am_pm(dt));
dt = new Date(1989, 10, 1);
console.log(upper_am_pm(dt));