Clock question

i’m making a background for the start screen of my game, right? and according to the time on the users clock, the background movie clip, instance named “sky”, is supposed to go to a certain frame that reflects the time of day. one, I don’t know how to reference a.m. and p.m. in my code. below is the code i’ve been trying to fix for an hour or so. Can somebody please tell me what’s wrong with it because i’m stumped.:frowning:

code:

var day:Boolean = false
var night:Boolean = false
var middle:Boolean = false

mydate = new Date();
minutes = mydate.getMinutes();
hours = mydate.getHours();

//----------------------------------------------------changing
if(day =true) {
this.sky.gotoAndStop(“Day”);
}

if(night =true) {
this.sky.gotoAndStop(“Night”);
}

if(middle =true) {
this.sky.gotoAndStop(“Middle”);
}

//---------------------------------------------------setting day
if (hours>7) {
day = true;
}

//---------------------------------------------------setting night
if(hours<6) {
day = false;
middle = false;
night = true;
}

//---------------------------------------------------setting middle
if(hours<7 && hours>6) {
middle = true;
day = false;
night = false;
}

if(hours>7 && hours<8) {
middle = true;
day = false;
night = false;
}