This JavaScript example prints the current time.
Click me to show time.
function gettime() { var dd = new Date(); var hh = dd.getHours(); var mm = dd.getMinutes(); var ss = dd.getSeconds(); alert("The time is now: " + hh + ":" + mm + ":" + ss); }
<p onClick="gettime(); return false;">Click me to show time.</p>