10 Mart 2013 Pazar

javascript current hours and minutes code

 DEMO: javascript current hours and minutes

Get Code:
<h4>It is now
<script type="text/javascript">
<!--
var currentTime = new Date()
var hours = currentTime.getHours()
var minutes = currentTime.getMinutes()
if (minutes < 10){
minutes = "0" + minutes
}
document.write(hours + ":" + minutes + " ")
if(hours > 11){
document.write("PM")
} else {
document.write("AM")
}
//-->
</script>
</h4>
Source: http://www.tizag.com/

0 yorum:

Yorum Gönder