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

js get time in am

var suffix = hour >= 12 ? "PM":"AM"; var hours = ((hour + 11) % 12 + 1) + suffix

how to convert time to am pm in javascript

Similar Code Examples