Click to See Complete Forum and Search --> : getMinutes


tiger66
08-28-2003, 11:43 AM
Hi
I am trying to get the current minutes of time.
I tried getMinutes(); mothod
when the minutes is single digit, it doesn't attach a zero before the digit.
e.g. time=12:07, it outputs 12:7 instead of 12:07
Is there a method to correct this problem? or do I need to manually correct it - write statment and attach a 0?

Thank

requestcode
08-28-2003, 11:54 AM
Yes you will have to do it. Here is an example:
var Digital=new Date()
var hours=Digital.getHours()
var minutes=Digital.getMinutes()
var seconds=Digital.getSeconds()
if(minutes<10)
{minutes="0"+minutes}
if(seconds<10)
{seconds="0"+seconds}