# Simple if/then using "getDay"

**URL:** <https://forum.kirupa.com/t/simple-if-then-using-getday/157386>\
**Category:** flash\
**Created:** [August 1, 2005, 5:21pm UTC](https://forum.kirupa.com/t/simple-if-then-using-getday/157386 "2005-08-01T17:21:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jasarius](https://avatars.discourse-cdn.com/v4/letter/j/ecccb3/32.png) [@jasarius](https://forum.kirupa.com/u/jasarius)\
**Post date:** [August 1, 2005, 5:21pm UTC](https://forum.kirupa.com/t/simple-if-then-using-getday/157386/1 "2005-08-01T17:21:20Z")

</div>

I’m trying to figure out how to integrate an if/then statement with the “getDay” function.

I want Flash to find out what the date is. I know I can do this with:

```auto
var dayOfWeek_array:Array = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
var today_date:Date = new Date();
var day_str:String = dayOfWeek_array[today_date.getDay()];
trace("Today is "+day_str);

```

That’ll get me today’s date.

How do I take that output, string, whatever and make an if/then statement to tell it what movie to load?

This doesn’t work, but here’s what I have:

```auto
if (day_str == 1) {
	loadMovieNum("promo.swf", this.fb_1);
}
if (day_str == 2) {
	loadMovieNum("promo.swf", this.fb_1);
}
if (day_str == 3) {
	loadMovieNum("wed.swf", this.fb_1);
} else {
	this.fb_1.loadMovie("promo.swf");
}
if (day_str == 4) {
	loadMovieNum("thur.swf", this.fb_1);
} else {
	this.fb_1.loadMovie("promo.swf");
}
if (day_str == 5) {
	loadMovieNum("fri.swf", this.fb_1);
} else {
	this.fb_1.loadMovie("promo.swf");
}
if (day_str == 6) {
	loadMovieNum("sat.swf", this.fb_1);
} else {
	this.fb_1.loadMovie("promo.swf");
}
if (day_str == 7) {
	loadMovieNum("promo.swf", this.fb_1);
}

```

How do I get these two to talk to each other, first finding the day value and then loading the correct movie based on that value?

A brief explanation on how you figured it out would be good to. I’m really trying to learn AS.

Thanks.
