My digital clock doesn't seems to work well! help!

I keep getting PM the whole day. Wht’s wrong with my AM?
herewith my actionscript:

onClipEvent (enterFrame) {
myTime = new Date();
nSeconds = myTime.getSeconds();
nMinutes = myTime.getMinutes();
nHours = myTime.getHours();
if (hours>=12) {
ampm = “pm”;
} else {
ampm = “am”;
}
if (hours>=13) {
nHours = nHours-12;
}
if (length(nMinutes) == 1) {
nHinutes = “0”+nMinutes;
}
if (length(nSeconds) == 1) {
nSeconds = “0”+nSeconds;
}
nTime = nHours+":"+nMinutes+":"+nSeconds+" "+ampm;
}

I’m a newbie so I don’t know if this is where the error lies but I’ll give it a shot:

if (hours>=12) {
ampm = “pm”;
} else {
ampm = “am”;
}
if (hours>=13) {
nHours = nHours-12;

Where the hell does the script get the hours from?! Maybe that’s the problem :slight_smile:

correct. change every “hours” into “nHours” I made a mistake in the code that I sent to Kirupa. I’ll have him change it when he gets the time…

thank you guys, i’ve been trying to figure it out long time ago…finally…thank you…

Hey jubba,
I updated the code :slight_smile:

Cheers,
Kirupa

Thanks Kirupa. When I wrote those tutorials I didn’t copy and paste the code, I re-wrote it into the Word document…ruff times…sorry abuot the screw-ups :slight_smile: