Javascript Date Time

Date & Time

<script type="text/javascript">
var currentdate = new Date()
document.write(currentdate)
document.write("<BR>")

var currentmonth = currentdate.getMonth()+1
document.write("Current months is ")
document.write(currentmonth)
document.write("<BR>")

var currenthours = currentdate.getHours()
document.write("Current hour ")
document.write(currenthours)
document.write("<BR>")

var timeofday = (currenthours < 12) ? "AM" : "PM"
currenthours = (currenthours > 12) ? currenthours – 12 : currenthours
currenthours = (currenthours == 0) ? 12 : currenthours
document.write(currenthours)

//getMonth, getHours, getSeconds, getDay, getMinutes

</script>