I am working with comparing dates. The problem I am having is that August (08) comes AFTER July (07). However, it seemed to consider Aug (08) and Sep (09) to be earlier than Jan-Jul. When I took a look at the values, they were shown as...

July = "07"
August = "00"
September = "00"

I remember a while back learning that the "default" number system used was the (Oct?) system...0-7 and that there was a function to tell it to recognize the number as coming from a decimal (1-10) system. I just cannot for the life of me remember what that function is.

Any help is greatly appreciated. Thanks.

SnotRockit
:?:

You've not supplied enough information. I'm not familiar with any octal-to-decimal operator, sorry.

Perhaps you could post the relevant code?

I remember a while back learning that the "default" number system used was the (Oct?) system...0-7

The default system is decimal, but if you put a '0' in front of your number it is Octal. But you would need to do your assignments without the string operator for this to take effect.

Read this: http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide:Literals#Integers

Or play with this:

<html>
<body>
<script language="javascript">

document.writeln("08 = " + 08 + "<br/>");
document.writeln("010 = " + 010 + "<br/>");
document.writeln("0x19 = " + 0x19 + "<br/>");
document.writeln("0xFF = " + 0xFF + "<br/>");

var string08 = "08";
document.writeln("string08 = " + string08 + "<br/>");
document.writeln("parseInt(string08, 8) = " + parseInt(string08, 8) + "<br/>");
document.writeln("parseInt(string08, 10) = " + parseInt(string08, 10) + "<br/>");
document.writeln("parseInt(string08, 16) = " + parseInt(string08, 16) + "<br/>");

document.writeln("8 = " + 8 + "<br/>");

</script>
</body>
</html>

It seems if you are silly, then your webbrowser will just assume you don't know what you are doing and use decimals.

If you're using parseInt to obtain 08 or 09's, You just have to set the redix (the numeral system) as 10 to get numbers in decimal system. Like this: parseInt(08,10). Bye!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.