Digital clock woes

I know, I know, another clock question from another dumb newbie…

In MX, is it possible to have a digital clock thats not in 24-hr time (ie. 7:05 instead of 19:05)? I’ve seen it on the net before, but i think they were created in MX2004…am i wrong? :h:

Also, in my clock, when i have seconds or minutes less than ten, they’re displayed with only one digit (ie. 5:3:2 is shown at 5:03:02). How do i fix this? Some if statements perhaps?:huh:

I hope I didn’t have anything here that was written anywhere else in the forums - i looked, but i didn’t find. :crying:

Thanks!

i’m not at my own computer right now so i don’t have the exact code in front of me, but it needs if statements. example:


if (minutes < 10) {
    outputtext = "0" + minutes;
}

as for the 12 hours thing, it’s the same.


if (hours > 12){
    hours = hours - 12;
}

again, this isn’t very detailed, but when i get back to my computer, i’ll post the code I used for mine.

ok, here’s the code that i used for mine:


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

where nTime is the variable name of the dynamic textbox that you’re outputing to.

does this help?

everything is working perfect! you’re awesome! :p: