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:
This is weird and I'm stumped. Any advice?
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();
This is weird and I'm stumped. Any advice?
I run your code, with a trace(dayNumber); at the end and I get '5' for today.
What happen with :
where, how are you checking or using its value?
var todaysDate:Date = new Date();
var dayNumber:Number = 5;
var hourNumber:Number = todaysDate.getHours();
var minuteNumber:Number = todaysDate.getMinutes();
where, how are you checking or using its value?
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
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>
<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>
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.
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.