javascript 24 hour time to am pm code example
Example 1: javascript conver time into 24 hour format
var dt = moment("12:15 AM", ["h:mm A"]).format("HH:mm");
Example 2: how to convert time to am pm in javascript
var suffix = hour >= 12 ? "PM":"AM";
var hours = ((hour + 11) % 12 + 1) + suffix