# Milliseconds displayed in two digits

**URL:** <https://forum.kirupa.com/t/milliseconds-displayed-in-two-digits/246661>\
**Category:** flash\
**Created:** [December 13, 2007, 8:07am UTC](https://forum.kirupa.com/t/milliseconds-displayed-in-two-digits/246661 "2007-12-13T08:07:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JackieMoon](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@JackieMoon](https://forum.kirupa.com/u/JackieMoon)\
**Post date:** [December 13, 2007, 8:07am UTC](https://forum.kirupa.com/t/milliseconds-displayed-in-two-digits/246661/1 "2007-12-13T08:07:56Z")

</div>

I wasn’t sure if this should be posted under ActionScript or not, but here goes. I created a digital clock. Everything works great. I have it displaying milliseconds and right now it only displays one digit from 1 to 9 very quickly of course. I want it to show two digits. Here is my code:

onClipEvent (enterFrame) {  
myTime = new Date();  
nSeconds = myTime.getSeconds();  
nMinutes = myTime.getMinutes();  
nHours = myTime.getHours();  
nMilliSeconds = myTime.getMilliseconds();  
//nMilli = (nSeconds+(nMinutes_60)+(nHours_3600)))_100);  
if (nHours\>=12) {  
ampm = “pm”;  
} else {  
ampm = “am”;  
}  
if (nHours\>=13) {  
nHours = nHours-12;  
}  
if (length(nMinutes) == 1) {  
nMinutes = “0”+nMinutes;  
}  
if (length(nSeconds) == 1) {  
nSeconds = “0”+nSeconds;  
}  
if (length(nHours) == 1){  
nHours = “0”+nHours;  
}  
\*\* if (length(nMilliSeconds) ==1){  
nMilliSeconds = “0”+nMilliSeconds; IGNORE THIS PART, I KNOW ITS NOT DOING ANYTHING_\*

```
    }

myHours3 = nHours+":"+nMinutes+":"+nSeconds+":"+nMilliSeconds;

```

}

I saw another post in the MX2004 forum, but I couldn’t get it to function properly. Any help would be greatly appreciated. Thanks.
