mktime Problems
Posted: Tue Aug 28, 2007 3:25 am
So I get in a date, lets say this date is 09/07/2007 as in July 9th 2007. Now when I try to mktime with this by doing:
which is obviously wrong. If I remove the leading 0 from the 09 then I get the correct output. The leading 0 infront of the 7 does not affect getting a correct output though. So really, what the heck?
I have been trying to come up with a way to remove the leading 0 from an int but without avail. The only thing I came up with was turning it into a string then getting the intval() from that but thats so silly. I have tried multiplying it by 1, casting it as an int, getting the intval, but nothing. And why does this leading 0 screw things up so badly in the first place?
Code: Select all
die(date('m-d-Y', mktime(1, 1, 1, 07, 09, 2007)));
//output: 06-30-2007I have been trying to come up with a way to remove the leading 0 from an int but without avail. The only thing I came up with was turning it into a string then getting the intval() from that but thats so silly. I have tried multiplying it by 1, casting it as an int, getting the intval, but nothing. And why does this leading 0 screw things up so badly in the first place?