php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40100 strtotime() first occurance of weekday returns wrong date
Submitted: 2007-01-11 15:14 UTC Modified: 2007-04-13 14:36 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: support at dailytechnology dot net Assigned: derick (profile)
Status: Not a bug Package: Date/time related
PHP Version: 5.2.0 OS: All
Private report: No CVE-ID: None
 [2007-01-11 15:14 UTC] support at dailytechnology dot net
Description:
------------
See also: http://bugs.php.net/bug.php?id=40003

Using 'Second Monday Jan 2007' or 'Second Tuesday Feb 2007' will return results ahead one week (occurs only when first occurrence of this weekday coincides with first of month).

Reproduce code:
---------------
echo date('Y-m-d', strtotime('second monday jan 2007'));

echo date('Y-m-d', strtotime('second monday feb 2007'));  

echo date('Y-m-d', strtotime('second thursday feb 2007'));

echo date('Y-m-d', strtotime('second thursday jan 2007')); 


Expected result:
----------------
2007-01-08

2007-02-08

2007-02-15

2007-01-11


Actual result:
--------------
2007-01-15

2007-02-12

2007-02-15

2007-01-11

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-13 14:36 UTC] derick@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

Same as #40003
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 03 11:01:32 2024 UTC