 Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki Blog Search Turing Chat Room Members
time.getDay troubles       Author Message
Fashoomp  Posted: Thu Mar 29, 2007 9:07 pm   Post subject: time.getDay troubles

ive been doing flash for 1 or 2 years, but never the actionscript portion. I just mostly do cool effects and stuff, but now i wanna learn actionscript. I have a base understanding of programming, from years of turing. I usually take a tutorial, and then try to expand on it, to make it cooler, or more advanced. So i took a simple clock tutorial and am trying to figure how to add the day. I have the right var, but it gives it back to me in a number, which is understandable. How can i convert it? I have already tried if statements, but it always comes back as sunday. I dont have enough understanding of AS to fix it myself, so i was hoping someone could help me. Heres what i have so far. clock_txt is the clock, day_txt is the day output
 code: time=new Date(); var seconds = time.getSeconds() var minutes = time.getMinutes() var hours = time.getHours() var day = time.getDay() var day_word:String; if (hours<12) {         ampm = "AM"; } else{         ampm = "PM"; } while(hours>12){         hours = hours - 12; } if (hours<10) {         hours = "0" + hours; } if (minutes<10) {         minutes = "0" + minutes; } if (seconds<10) {         seconds = "0" + seconds; } if (day = 1) {         day_word = "Monday"; } if (day = 2) {         day_word = "Tuesday"; } if (day = 3) {         day_word = "Wednesday"; } if (day = 4) {         day_word = "Thursday"; } if (day = 5) {         day_word = "Friday"; } if (day = 6) {         day_word = "Saturday"; } if (day = 7) {         day_word = "Sunday"; } clock_txt.text = hours + ":" + minutes + ":" + seconds + " " + ampm; date_txt.text = day_word            