yowzer14 wrote:
Code: Select all
hours1 = parseInt(time[0],10);
minutes1 = parseInt(time[1],10);
seconds1 = parseInt(time[2],10);
This bit might be the bit I'm looking for (for the leading 0's problem) too!!
I'll take a look at both suggestions next week - and implement them when I have time!!
Cheers for both of your help.
C.
PS Here's the explanation...
parseInt(string, radix)
If the radix parameter is omitted, JavaScript assumes the following:
If the string begins with "0x", the radix is 16 (hexadecimal)
If the string begins with "0", the radix is 8 (octal). This feature is deprecated
If the string begins with any other value, the radix is 10 (decimal)
----
So I assmume that the code is thinking that it is parsing an octal number...
Thus 08, 09 are above 7 (The limit of Octal) and returning a 0.
C.