/ Published in: JavaScript
Expand |
Embed | Plain Text
var today = new Date(); var tag; //process Hours var hours = today.getHours(); if (hours > 12){ hours = hours - 12; tag = "PM"; } else {tag = "AM"} //process Minutes var minutes = today.getMinutes(); if (minutes < 10) minutes = "0" + minutes; //process Seconds var seconds = today.getSeconds(); if (seconds < 10) seconds = "0" + seconds; var cur_time = " " + hours + ":" + minutes + ":" + seconds + " " + tag;
You need to login to post a comment.
