View Full Version : current date and time
audrius'05
September 30th, 2005, 05:07 AM
Does anyone have a script for current date?? like for example todays date i nthis format: December 15, 2005
TheCanadian
September 30th, 2005, 05:11 AM
http://www.kirupa.com/developer/actionscript/digital_clock.htm :)
audrius'05
October 1st, 2005, 04:31 PM
Thank you TheCanadian, problem with that is that its not displaying current date, shows me November 1 supose to show me Ocrober 1. Any ideas why?
Jeff Wheeler
October 1st, 2005, 04:42 PM
displayDate = nMonth-1+" "+nDate+", "+nYear;
I didn't read the original tutorial, or the rest of the code, but that might fix it. It could be a one-off error, because arrays start at 0, rather than 1.
Also, if somebody wants the date, it's always gonna be on their screen.
audrius'05
October 1st, 2005, 04:48 PM
Also, if somebody wants the date, it's always gonna be on their screen.
What do you mean on their screen? do u mean task bar/windows clock ?
Jeff Wheeler
October 1st, 2005, 04:48 PM
Exactly :)
Windows, Linux, and Mac all have it…
audrius'05
October 1st, 2005, 04:51 PM
nope! this code
displayDate = nMonth-1+""+nDate+", "+nYear; didn't help
audrius'05
October 1st, 2005, 04:54 PM
Exactly :)
Windows, Linux, and Mac all have it…
I know but some people don't know how to double click :P in Windows etc, but the purpose of it is that it gives some people the immpresion that website is always being maintained, if you know what I mean
Jeff Wheeler
October 1st, 2005, 04:54 PM
Woops, that line was fine, do this instead:
nMonth = mon[now.getMonth()-1];
audrius'05
October 1st, 2005, 05:17 PM
Yep, it helped this time, thank you so much nokrev, I really appreciate your efforts;
TheCanadian
October 1st, 2005, 06:52 PM
Actually the problem is that the mon array is missing September. The code should look like:
onClipEvent (load) {
mon = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec"];
weekdays = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
}
onClipEvent (enterFrame) {
now = new Date();
nDay = weekdays[now.getDay()];
nMonth = mon[now.getMonth()];
nDate = now.getDate();
nYear = now.getFullYear();
displayDate = nMonth + " " + nDate + ", " + nYear;
displayDay = nDay;
}
Krilnon
October 1st, 2005, 06:55 PM
Actually the problem is that the mon array is missing September.
Weird! I can't believe that that hasn't been corrected yet…
Jeff Wheeler
October 1st, 2005, 07:01 PM
Haha. That's a good reason too…
Krilnon
October 1st, 2005, 07:04 PM
Update: Kirupa corrected it :)
Jeff Wheeler
October 1st, 2005, 07:05 PM
Arg! I was just about to tell him ;P
kirupa
October 1st, 2005, 07:07 PM
Fixed :)
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.