# Date object with if/else?

**URL:** <https://forum.kirupa.com/t/date-object-with-if-else/104363>\
**Category:** Uncategorized\
**Created:** [March 15, 2004, 2:49pm UTC](https://forum.kirupa.com/t/date-object-with-if-else/104363 "2004-03-15T14:49:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![max56](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/max56/32/465_2.png) [@max56](https://forum.kirupa.com/u/max56)\
**Post date:** [March 15, 2004, 2:49pm UTC](https://forum.kirupa.com/t/date-object-with-if-else/104363/1 "2004-03-15T14:49:53Z")

</div>

i’m using the date object to pull up different movies at different times of day. but can’t figure out the syntax for the if/else statement to allow for time frames.  
this is what i want in english.  
play movie A between 8am-1pm then play movie B between 1pm-5pm. then  
play movie C between 5pm-8pm then  
play movie D between 8pm-midnight etc  
I actually want 5 different time frames for 5 different movies.  
here’s my actionscript attempt.

on (release) {  
now = new Date();  
now.getHours()  
if (now \<= 13) {  
getURL(“hmorning.html”, “mainthing”);  
} else if (now \>= 13 ) {  
getURL(“hafternoon.html”, “mainthing”);  
} else if (now \>= 17 ) {  
getURL(“heven.html”, “mainthing”);  
}  
}

this only works for two different time frames. greater than/less than.  
any ideas… much appreciated.  
max
