How do you get that?
myDate = new Date()
myYear = myDate.getFullYear()
myMonth = myDate.getMonth()
myDay = myDate.getDay()
dateBox.text = myDay + "/" + myMonth + "/" + myYear
place a dynamic text field on the stage and name it “dateBox” [no quotes]
Here is some code I whipped up when I was working on a new site…
// This creates two ARRAYs that swap returned numbers with values (i.e. 0=Sunday, 4=Thursday & 1=January, 7=August)
onClipEvent (load) {
days = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday');
months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
timedate = new Date();
}
// This action actually calls out to the users system to grab the current date and time
// The date is grabbed from the ARRAYs earlier set
onClipEvent (enterFrame) {
now = new Date();
todaydate = timedate.getDate();
day = timedate.getDay();
dayname = days[day];
month = (timedate.getMonth()+1);
monthname = months[month-1];
year = timedate.getFullYear();
seconds = now.getSeconds();
minutes = now.getMinutes();
hours = now.getHours();
if (Hours>=12) {
ampm = "pm";
} else {
ampm = "am";
}
if (Hours>=13) {
Hours = Hours-12;
}
if (length(Minutes) == 1) {
Minutes = "0"+Minutes;
}
if (length(Seconds) == 1) {
Seconds = "0"+Seconds;
}
currenttime = Hours+":"+Minutes+":"+Seconds+" "+ampm;
currentdate = todaydate+"/"+month+"/"+year;
fulldate = dayname+", "+monthname+" "+todaydate+", "+year;
delete timedate;
timedate = new Date();
}
Probably foreign if you dont understand the script so I was kind enough to zip a fla with the source and code in there. This also has the time, but if you want to remove it just delted the time textbox, I wouldn’t suggest editing the code.
Also, since they replied as well, here is a tutorial that I wrote that gets the date and time. You can modify the code to get just the date:
http://www.kirupa.com/developer/actionscript/digital_clock.asp
Thanks for all this information!