Link to home
Create AccountLog in
Avatar of centurydana
centurydana

asked on

Actionscript 2.0 getDay() Always Returns 1

Hey fols.  I am just writing a simple animation, which will determine the next place in the timeline to go to, based on which day it is.  I have written the following code to grab the appropriate DayofWeek and Hour and Minutes numbers for some comparions.

For some reason, even though the date field todaysDate is pulling in as set on my PC accurately, the getDays() function always returns 1 as dayNumber.  hourNumber and minuteNumber are populating correctly:

var todaysDate:Date = new Date();
var dayNumber:Number = todaysDate.getDay();
var hourNumber:Number = todaysDate.getHours();
var minuteNumber:Number = todaysDate.getMinutes(); 

Open in new window


This is weird and I'm stumped.  Any advice?
Avatar of quizengine
quizengine
Flag of United Kingdom of Great Britain and Northern Ireland image

I run your code, with a trace(dayNumber); at the end and I get '5' for today.
Avatar of leakim971
What happen with :
var todaysDate:Date = new Date();
var dayNumber:Number = 5;
var hourNumber:Number = todaysDate.getHours();
var minuteNumber:Number = todaysDate.getMinutes(); 

Open in new window


where, how are you checking or using its value?
ASKER CERTIFIED SOLUTION
Avatar of quizengine
quizengine
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
can you try check in the javascript if you are getting the same value or not

<script>

var todaysDate:Date = new Date();
var dayNumber:Number = todaysDate.getDay();
var hourNumber:Number = todaysDate.getHours();
var minuteNumber:Number = todaysDate.getMinutes();

alert(dayNumber + "+" + hourNumber + "+"+minuteNumber );
</script>
Avatar of centurydana
centurydana

ASKER

Wow.  Very well done.  You have to have seen this a few times to prognosticate that the problem came from code other than what was shared.

I'm pretty new to conditionals in ActionScript as I'm usually a SQL guy.  What a strange convention!  Thanks for the help and full points to you.