php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #34676 missing support for strtotime("midnight") and strtotime("noon")
Submitted: 2005-09-29 06:20 UTC Modified: 2005-10-08 16:31 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: rajiv at alum dot mit dot edu Assigned: derick (profile)
Status: Closed Package: Feature/Change Request
PHP Version: 5CVS, 4CVS (2005-09-29) OS: *
Private report: No CVE-ID: None
 [2005-09-29 06:20 UTC] rajiv at alum dot mit dot edu
Description:
------------
strtotime() should be able to parse "midnight" and "noon".


Reproduce code:
---------------
echo strtotime("midnight");
echo strtotime("noon");


Expected result:
----------------
echo strtotime("midnight");
  should print the time stamp for the next midnight
  (midnight tomorrow).

echo strtotime("noon");
  should print the time stamp for the next noon
  (noon today/tomorrow depending on the current time).

echo strtotime("12:00 am");
echo strtotime("12 am");
echo strtotime("12:00 pm");
echo strtotime("12 pm");
  all do the correct things.


Actual result:
--------------
echo strtotime("midnight");
  returns -1.

echo strtotime("noon");
  returns -1.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-29 09:11 UTC] sniper@php.net
Reclassified as feature request and assigned to Derick so he can add in PHP 5.1.x. :)
 [2005-10-08 15:45 UTC] derick@php.net
I can implement this, but I do not agree that "noon" should go to the next day if it's already in the afternoon here. IMO that doesn't make any sense. Also, I'm not totally sure why "noon" and "midnight" are better than "00:00" and "12:00"...
 [2005-10-08 16:31 UTC] derick@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 [2005-10-08 16:31 UTC] derick@php.net
(Only for PHP 5.1 and higher btw)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 02:01:28 2024 UTC