php.net |  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
Votes:1
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
Description:
------------
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))

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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