Jump to content

Strtotime() Question


tqla

Recommended Posts

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?

 

:confused:

 

Thanks.

Link to comment
Share on other sites

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.

Edited by tqla
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.