# Clock question

**URL:** <https://forum.kirupa.com/t/clock-question/208799>\
**Category:** Uncategorized\
**Created:** [December 2, 2006, 8:34pm UTC](https://forum.kirupa.com/t/clock-question/208799 "2006-12-02T20:34:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![idjit](https://avatars.discourse-cdn.com/v4/letter/i/e99b99/32.png) [@idjit](https://forum.kirupa.com/u/idjit)\
**Post date:** [December 2, 2006, 8:34pm UTC](https://forum.kirupa.com/t/clock-question/208799/1 "2006-12-02T20:34:02Z")

</div>

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.☹

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;  
}
