0

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
5
Contributors
6
Replies
28
Views
3 Years
Discussion Span
Last Post by amit.chaudhari.71
0

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)

1

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

0

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

0

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

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

diafol sir plz give any solution

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.