i´m using this code to make a digital clock:
onClipEvent (enterFrame) {
myTime = new Date();
nMinutes = myTime.getMinutes();
nHours = myTime.getHours();
if (hours>=13) {
nHours = nHours-12;
}
if (length(nMinutes) <= 1) {
nHinutes = "0"+nMinutes;
}
nTime = nHours+":"+nMinutes+nSeconds+" "+ampm;
}
The problem is that when the minutes are <10, it´s shown like this>
13:9 pm
how do I solve this?^
thanks
system
June 12, 2003, 4:30pm
2
the code is wrong.
if (length(nMinutes) <= 1) {
nHinutes = "0"+nMinutes;
}
should be
if (length(nMinutes) <= 1) {
nMinutes = "0"+nMinutes;
}
system
June 12, 2003, 5:17pm
3
I DON´T BELIVE IT!!!
I didn´t see it!
thanks a lot
system
June 12, 2003, 5:22pm
4
did you take that from the tutorial on this site? That looks like my code… There is a mistake on the tutorial code that I gave Kirupa because I was in a rush to write it. Been there for a while, Kirupa hasn’t gotten a chance to modify it yet…
I’ll bring it up to him again.
system
June 12, 2003, 5:32pm
5
yes, that´s from kirupas tutorial, but I changed and got just the hour.