var dt = new Date();
function settime(dt) {
var hours = dt.getHours()
var minutes = dt.getMinutes()
if (minutes < 10)
minutes = "0" + minutes
var suffix = "AM";
if (hours >= 12) {
suffix = "PM";
hours = hours - 12;
}
if (hours == 0) {
hours = 12;
}
// set the date back to the current date
return hours + ":" + minutes + " " + suffix
}
//call the function
var time=settime(dt);
//set the time in your text box
$('#CallTime').val(time);
No comments:
Post a Comment