My javascript date time display

<script type="text/javascript">
<!--
var currentTime = new Date()
var month = currentTime.getMonth() + 1
var day = currentTime.getDate()
var year = currentTime.getFullYear()
var currentTime = new Date()
var hours = currentTime.getHours()
var minutes = currentTime.getMinutes()
if (minutes < 10)
minutes = "0" + minutes
if (hours < 10)
hours = "0" + hours
if (day < 10)
day = "0" + day
if (month < 10)
month = "0" + month
document.write(year + "-" + month + "-" + day + " " + hours + ":" + minutes + " ")
//-->
</script>

Same idea, but for VBScript:

<script type="text/vbscript">
dim dispdate
if month(date) > 10 then
dispdate = '0' & date
else
dispdate = date
end if
document.write(dispdate)
</script>
Advertisements