|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-10-31 17:27 UTC] oliver at realtsp dot com
[2011-02-21 20:58 UTC] jani@php.net
-Summary: date parsing in DateTime / date_parse - accept
optioanl format
+Summary: date parsing in DateTime / date_parse - accept
optional format
-Package: Feature/Change Request
+Package: Date/time related
[2014-01-25 14:29 UTC] derick@php.net
-Status: Open
+Status: Not a bug
[2014-01-25 14:29 UTC] derick@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 01:00:01 2025 UTC |
Description: ------------ The default set of date/times accepted by strtotime() is limited (e.g. in not understanding English/UK date formats (dd/mm/yyyy). It would be nice if the new DateTime object accepted a date() compatible format string to a 'date_parse' like method. (I like the DateTime object, as it seems to handle a larger range of dates than strtotime() for me). Reproduce code: --------------- <?php $dt = new DateTime(); $dt->parse('30/12/1601', 'd/m/Y'); echo $dt->format('Y/m/d'); ?> (Presumably successive parse calls would overwrite the state from a previous one) Expected result: ---------------- 1601/12/30. If both formats are the same, then the output should match the input. Actual result: -------------- n/a.