|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-05-19 01:59 UTC] judas dot iscariote at gmail dot com
[2006-05-19 07:12 UTC] derick@php.net
[2006-05-19 14:53 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 09:00:02 2025 UTC |
Description: ------------ When using strtotime to parse dates if an 'am' or 'pm' is added without specifying a year false will be returned. Reproduce code: --------------- echo date('r', strtotime('May 18th 5:05')); echo date('r', strtotime('May 18th 5:05pm')); echo date('r', strtotime('May 18th 5:05 pm')); echo date('r', strtotime('May 18th 5:05am')); echo date('r', strtotime('May 18th 5:05 am')); echo date('r', strtotime('May 18th 2006 5:05pm')); Expected result: ---------------- Thu, 18 May 2006 05:05:00 -0700 Thu, 18 May 2006 17:05:00 -0700 Thu, 18 May 2006 17:05:00 -0700 Thu, 18 May 2006 05:05:00 -0700 Thu, 18 May 2006 05:05:00 -0700 Thu, 18 May 2006 17:05:00 -0700 Actual result: -------------- Thu, 18 May 2006 05:05:00 -0700 Wed, 31 Dec 1969 16:00:00 -0800 Wed, 31 Dec 1969 16:00:00 -0800 Wed, 31 Dec 1969 16:00:00 -0800 Wed, 31 Dec 1969 16:00:00 -0800 Thu, 18 May 2006 17:05:00 -0700