Hi all,
how can I split a number into sub digits. I have a number 20:55
n need to split in to two parts as 20
and 55
.
var mynumber = 20:55;
var split = mynumber.toString();
document.write("Hour : " + split[0]);
document.write("Minutes : " + split[1]);
but am getting wrong value after toString() function call.
EDIT: 1 This is what I want. This is working fine but only works with windows. In linux Firefox am not getting the correct value in function .. something like 12.200000000000000001
instead of 12.25
<script type="text/javascript">
var myarray = new Array();
myarray = [[12.25, 1],[13.25,1]];
//alert(myarray[0][0]);
func(myarray[0][0]) ;
function func(n) {
var split = n.split(".");
document.writeln("Number : " + n); // Number : 12.25
document.writeln("Hour : " + split[0]); // Hour : 12
document.writeln("Minutes : " + split[1]); // Minutes : 25
}
</script>