PDA

View Full Version : date


bimo
11-18-2005, 07:11 PM
I know this is a sillt question but how do I format the date and time to get in a number format i.e: 20051103132458? I've found a lot of people who claim to know how to do that but I try these methods and still get Fri Nov 18 13:58:25 GMT-0500 2005.


I can't figure out what I'm doing wrong. Any help would be appreciated.

Thanks

arkanoid2k
11-18-2005, 08:38 PM
maybe this will help.


today_date = new Date();
date_str = ((today_date.getMonth() + 1) +":"+ today_date.getDate()+":" +
today_date.getFullYear());
trace(date_str)

bimo
11-18-2005, 08:56 PM
thanks. the YEAR month and day work but when I tried to add " + today_Date.getHours() + today_Date.getMinutes() + today_Date.getSeconds()" it just gave NaN. do the time functions not work the same way?

arkanoid2k
11-18-2005, 09:51 PM
check the spelling of the VAR. it should be "today_date" all in small letters.
if you dont separete terms with the ":" the result will be de adittion of the values.
try using toString() to avoid the ":"

bimo
11-19-2005, 12:23 AM
ah, I had today_Date instead of today_date. thanks.