Answers for "how to get current time in javascript with am pm"

4

js get time in am

var time = new Date();
console.log(
  time.toLocaleString('en-US', { hour: 'numeric', hour12: true })
);
Posted by: Guest on April-28-2020
3

how to convert time to am pm in javascript

var suffix = hour >= 12 ? "PM":"AM";
var hours = ((hour + 11) % 12 + 1) + suffix
Posted by: Guest on April-02-2020

Code answers related to "how to get current time in javascript with am pm"

Code answers related to "Javascript"

Browse Popular Code Answers by Language