Hello Reader's If you want to show current date in a html div, Then you can genrate it in JS then show back to html. Here is the example below:-
<div id="Console"></div>
Now the script will go like this:-
window.onload = function() {
var now = new Date();
var strDateTime = [[AddZero(now.getDate()), AddZero(now.getMonth() + 1), now.getFullYear()].join("/"), [AddZero(now.getHours()), AddZero(now.getMinutes())].join(":"), now.getHours() >= 12 ? "PM" : "AM"].join(" ");
document.getElementById("Console").innerHTML = "Now: " + strDateTime;
};
function AddZero(num) {
return (num >= 0 && num < 10) ? "0" + num : num + "";
}
Output:-
Now: 09/12/2015 16:08 PM
0 Comment(s)