I want the date&time to be in this format. For example
2012/3/21 23:47:01 2011/11/23 19:33:02
Is it make use of java script? Any source code or tutorial help? Many thanks!
I want the date&time to be in this format. For example
2012/3/21 23:47:01 2011/11/23 19:33:02
Is it make use of java script? Any source code or tutorial help? Many thanks!
This article may be dated, but it should still do the trick http://www.tizag.com/javascriptT/javascriptdate.php
To return the current date, you can use something like:
var currentTime = new Date()
var month = currentTime.getMonth() + 1
var day = currentTime.getDate()
var year = currentTime.getFullYear()
document.write(month + "/" + day + "/" + year)
And to return the time you can use something like:
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")
}