|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75834 Certain relative format dates do not return midnight as they should
Submitted: 2018-01-17 13:32 UTC Modified: 2021-07-14 14:13 UTC
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: igor dot yavych at gmail dot com Assigned: cmb (profile)
Status: Not a bug Package: Date/time related
PHP Version: Irrelevant OS: Unix
Private report: No CVE-ID: None
 [2018-01-17 13:32 UTC] igor dot yavych at gmail dot com
Title says it all, test script, expected result and actual result section demonstrate the problem

Test script:
strtotime('first day of this month'); 
strtotime('last day of this month');
strtotime('first day of last month');
strtotime('last day of last month');
strtotime('first day of this month UTC')
strtotime('last day of this month UTC');
strtotime('first day of last month UTC');
strtotime('last day of last month UTC');

Expected result:
For all of the above, in the test script part, it should output midnight of that date in a respective TZ (either server (first 4) or UTC (last 4)), as other relativate formats do (for example 'monday last week UTC', 'sunday this week UTC', etc). Expected result can be achieved if you put 'midnight' in the begining of each string, ie 'midnight last day of last month UTC'

Actual result:
For all of the above, in the test script part, it outputs the correct date but instead of midnight, it's current time in a respective TZ (either server (first 4) or UTC (last 4))


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-03-25 13:39 UTC]
-Package: date_time +Package: Date/time related
 [2021-07-14 14:13 UTC]
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2021-07-14 14:13 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 29 08:01:32 2024 UTC