Monday, June 27, 2011

Re: [phpXperts] Interesting Problem!!!

 

Hi Yamin vai!


Your problem is due to the maximum positive value an integer variable can hold.

For integer being signed has a maximum value of 2147483647

So if you pass it to date() u get this - 

01/19/2038 03:14:07 am

That's the max u can go

On Tue, Jun 28, 2011 at 9:53 AM, Chris Williams <chris@clwill.com> wrote:
 

Use the DateTime construct. See:
http://us3.php.net/manual/en/datetime.gettimestamp.php



On 6/27/11 5:26 PM, "ymnoor21" <ymnoor21@yahoo.com> wrote:

>Hi everyone,
>I was working with PHP's core date function and came across an
>interesting problem. Ex:
>
>echo date("m/d/Y", strtotime("2038-01-18"));
>prints: 01/18/2038
>
>but if you go beyond that date, then it goes back to this: 12/31/1969
>
>Looks like i've hit the wall. I knew that PHP had a setdate limitation
>for unix (1902 - 2037) & for windows (1971 - 2037). But my question was
>why it would show me a date of 2038 even though they are limited to year
>2037 by theory? Probably something to do with 32bit or 64bit issue.
>Anyway, i have to deal a workaround for setting future dates (ex:
>12/31/2111), unless if you guys have any solution using PHP's core date
>object / function.
>
>Please do let me know if you find this problem interesting & have a good
>solution for this.
>
>Thanks
>Yamin
>
>
>
>------------------------------------
>
>Visit phpXperts website at www.phpxperts.netYahoo! Groups Links
>
>
>




--
Anjan Bhowmik
Freelance Software & Web Developer
M : +880 - 1670 - 556419
E : anjan011@gmail.cominfo@ultrasoftbd.com
Site: http://www.onlyfreelancer.com/ - Only for Freelancer's!

__._,_.___
Recent Activity:
Visit phpXperts website at www.phpxperts.net
.

__,_._,___

No comments: