tqla Posted November 14, 2012 Share Posted November 14, 2012 Hello. I do not need to know how to write this another way. I just am curious as to why this happens. Why does strtotime() print the expected result when I add 25 years: <?php $thedate = date('D M Y', strtotime("+25 year")); echo $thedate; ?> But it fails to print the expected result when I add 26 years. Instead it reads "Wed Dec 1969" <?php $thedate = date('D M Y', strtotime("+26 year")); echo $thedate; ?> Is it my version of PHP? Is there a 25 year limit? Does this happen on your system? Thanks. Link to comment https://forums.phpfreaks.com/topic/270705-strtotime-question/ Share on other sites More sharing options...
MDCode Posted November 14, 2012 Share Posted November 14, 2012 I'm not sure as to what your problem could be as this works on my site. Perhaps a version of php problem. Link to comment https://forums.phpfreaks.com/topic/270705-strtotime-question/#findComment-1392483 Share on other sites More sharing options...
PFMaBiSmAd Posted November 14, 2012 Share Posted November 14, 2012 On 32bit versions of php, the maximum integer value corresponds to - Tue, 19 Jan 2038 03:14:07 UTC Link to comment https://forums.phpfreaks.com/topic/270705-strtotime-question/#findComment-1392485 Share on other sites More sharing options...
requinix Posted November 14, 2012 Share Posted November 14, 2012 Y2K38 Link to comment https://forums.phpfreaks.com/topic/270705-strtotime-question/#findComment-1392487 Share on other sites More sharing options...
tqla Posted November 15, 2012 Author Share Posted November 15, 2012 Thank you all. SocialCloud, I'm glad it works in your (most likely later) version of PHP. Troubling that that sytax fails in some versions. PFMaBiSmAd and requinix, thank you for the 2038 info, the 32bit limitation it is indeed concerning. Link to comment https://forums.phpfreaks.com/topic/270705-strtotime-question/#findComment-1392491 Share on other sites More sharing options...
PFMaBiSmAd Posted November 15, 2012 Share Posted November 15, 2012 The php datetime class/extension should not have this problem, even on 32bit systems, assuming that you don't try to convert the result to a Unix timestamp in an integer variable. Link to comment https://forums.phpfreaks.com/topic/270705-strtotime-question/#findComment-1392498 Share on other sites More sharing options...
Mahngiel Posted November 15, 2012 Share Posted November 15, 2012 Y2K38 We have to survive the mayan calendar first! Link to comment https://forums.phpfreaks.com/topic/270705-strtotime-question/#findComment-1392511 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.