Page 1 of 1
Bug in php 5.0.3?
Posted: Tue Jul 12, 2005 6:20 am
by tores
Hi
Try out this code...
Code: Select all
echo date('d F Y', strtotime('next monday', strtotime('15 July 2005')));
15th of July is on a Friday. Next monday is then 18th of July. However, when I run this code, 25th of July is returned... Is there a known bug in strtotime() for php ver. 5.0.3 that causes this?
regards tores
Posted: Tue Jul 12, 2005 6:51 am
by timvw
If tried for 'monday' and this gave me 18 July 2005
Code: Select all
echo date('d F Y', strtotime('monday', strtotime('15 July 2005')));
So, from that result, it appears logical that 'next monday' is 25 July 2005
Code: Select all
echo date('d F Y', strtotime('last monday', strtotime('15 July 2005')));
echo "<br>";
echo date('d F Y', strtotime('monday', strtotime('15 July 2005')));
echo "<br>";
echo date('d F Y', strtotime('next monday', strtotime('15 July 2005')));
Posted: Tue Jul 12, 2005 7:07 am
by tores
Relative dates for dummies:)
Code: Select all
echo date('d F Y', strtotime('last monday', strtotime('15 July 2005'))); // 11th
echo "<br>";
echo date('d F Y', strtotime('this monday', strtotime('15 July 2005'))); // 18th
echo "<br>";
echo date('d F Y', strtotime('next monday', strtotime('15 July 2005'))); // 25th