There are many ways to write the date using JS...
There's isn't one format (or a right and wrong), you would use the .getDate, getMonth, getFullYear syntax...
This is what I use in my website:
<SCRIPT>
var mydate=new Date()
var theYear=mydate.getFullYear()
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"
var montharray=new Array("01","02","03","04","05","06","07","08","09","10","11","12"
document.write("<font face='Geneva, Arial, Helvetica, san-serif'><h6>"+dayarray[day]+"<br>"+montharray[month]+"/"+daym+"/"+theYear+"</h6></font>"
</SCRIPT>
The document.write method displays the date on the browser in any location. I have not failed; I merely found 100,000 different ways of not succeding...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.