PDA

View Full Version : Get date prob


Sonic_Mush
07-31-2002, 10:57 PM
hopefully some one can help me with this,

ive got a dynamic text which should show the current date but the command below returns a blank space

today=myDate.getDate();

the name "today" is the correct name(same as the dynamic variable)

can anybody help?

thxs in advance,

Abelius
07-31-2002, 11:53 PM
Did you initialize it as "new Date"...?

xxlm
08-01-2002, 02:36 AM
As abelius said:

today=new Date().getDate();


;)

Sonic_Mush
08-01-2002, 11:41 AM
ow, well now u know why i put the post in here,

i didnt even know that commad exsisted,

thanks again

Sonic_Mush
08-01-2002, 12:06 PM
no point making a new thread so here it is,

thxs to ur help ive now got the getMonth(); etc working but get year seems to result in 102 and month in 7 with both being wrong, it might just be my clock,

begin=30
begin2=7
begin3=2002
today=new Date().getDate();
today2=new Date().getMonth();
today3=new Date().getYear();

but if theres a script problem can some one explain


ive also tried working out the days since the start ("begin") and come up with,

old=(30-"begin")+("today2"-"begin2")*30+"today")

but flash keeps asking for ";" whcih seems to sugest there is something missing, because it doesnt seem to matter were i put the ";" it still syas its missing,

so thxs again
and any help is grealty appricated

--edited to add formula

farafiro
08-01-2002, 01:15 PM
for the year u can use getFullYear()
for thisold=(30-"begin")+("today2"-"begin2")*30+"today")
make it soold = (30-begin)+":"+(today2-begin2)+":"+(30+today)

xxlm
08-01-2002, 01:16 PM
Look pretty well on the help... It gaves the time (years, month,..) from a begining one (1900 I think). See what I mean.
So if your year is 2002 the 2002-1900 = 102.
OK?!
;)

red penguin
08-02-2002, 12:51 PM
There's some sort of weird language thing going on here...anyway...you only need to construct the date object once...

myDate = new Date();
txt_date = ((myDate.getMonth() + 1) + " : " + myDate.getDate() + " : " + myDate.getFullYear());

tg
08-02-2002, 05:15 PM
the reason why you need to jump thru the hoops for getMonth() is cause flash sees months this way:
months run 0-11...
january=0
february=1
march=2
... and so on.