This function will help:
Code:
function FormatNumber( n )
{
// Split the number into thousands chunks
var arrBits = new Array();
var i = 0;
while (n > 0)
{
arrBits[i] = '' + n % 1000;
n = Math.floor(n / 1000);
// Add padding zeroes if necessary
if (n > 0)
{
while (arrBits[i].length < 3)
arrBits[i] = '0' + arrBits[i];
}
i++;
}
arrBits = arrBits.reverse();
// join() uses a comma as the default separator - to use anything
// else just specify it as a parameter eg. join('.')
return arrBits.join();
}
Debug.trace( FormatNumber("1") + "\n" );
Debug.trace( FormatNumber("12") + "\n" );
Debug.trace( FormatNumber("123") + "\n" );
Debug.trace( FormatNumber("1234") + "\n" );
Debug.trace( FormatNumber("12345") + "\n" );
Debug.trace( FormatNumber("123456") + "\n" );
Debug.trace( FormatNumber("1234567") + "\n" );
Debug.trace( FormatNumber("12345678") + "\n" );
Debug.trace( FormatNumber("123456789") + "\n" );
With regard to the time
Code:
var Hour = ((SYSTEM_TIME_12HOUR < 10) ? '0' : '') + SYSTEM_TIME_12HOUR;
var Min = ((SYSTEM_TIME_MINUTE < 10) ? '0' : '') + SYSTEM_TIME_MINUTE;
var Sec = ((SYSTEM_TIME_SECOND < 10) ? '0' : '') + SYSTEM_TIME_SECOND;
Debug.trace( Hour + ":" + Min + ":" + Sec );