Answers for "how to conver time format to 12 hours in javascript"

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
0

how to conver time format to 12 hours in javascript

var hours = dt.getHours()
minute = dt.getMinutes();
hours = (hours % 12) || 12;
console.log("Time is - " + hours + ":" + minure;
Posted by: Guest on January-01-2021

Code answers related to "how to conver time format to 12 hours in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language