dear friends

    m using strtotime () function to compare two dates , but it is not working for the date greater then '19-jan-2038'.my os is win 7 32 bit and php 5.2 and apache 2.2.plz if any body having any solution , kindly share it

This is the best way strtotime() works for me. A string like so '05/23/2014' in a mm/dd/yyyy format converts to 1400821200 in time and the datatype should be int. To convert back to date format, you can do date('d-m-Y',1400821200)

Member Avatar

Use DateTime() as this does not use internal integers and gets around the 32-bit issue.

The maximum value of a 32-bit integer is 2,147,483,647. 2,147,483,647 seconds from 01-01-1970 00:00:00 is January 19, 2038. If you add one more second, you get a date somewhere in 1902... so, your answer would by what @diafol said

but i am still facing problem to retrive current date ( which is after '19-jan-2038') by datetime function. my code is as follows:

$date= new datetime();
echo $date->format('d-m-Y');

diafol sir plz give any solution