PDA

View Full Version : script date



benslayton
07-04-2006, 02:59 PM
I need to know how to change the year to '06 instead of 2006 in this script.

<script>
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
var dayarray=new Array("Sun","Mon","Tues","Wed","Thur","Fri","Sat")
var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
document.write("<small><font color='000000' face='Arial'><b>"+dayarray[day]+", "+montharray[month]+" "+daym+", "+year+"</b></font></small>")

</script>
Does any one know

Twey
07-04-2006, 03:06 PM
Simplest method is:
var year = mydate.getYear().toString().substring(2) + 0;