|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-03-26 04:57 UTC] aharvey@php.net
-Status: Open
+Status: Assigned
-Assigned To:
+Assigned To: aharvey
[2010-03-26 05:31 UTC] aharvey@php.net
[2010-03-26 05:31 UTC] aharvey@php.net
-Status: Assigned
+Status: Closed
[2010-03-26 05:31 UTC] aharvey@php.net
[2010-03-26 11:12 UTC] aharvey@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 00:00:01 2025 UTC |
Description: ------------ I was trying to process Apache logfiles with PHP. The default LogFormat timestamp %t translates to '[d/M/Y:H:i:s O]' in date() notation. PHP fails to create DateTime instances if the format argument contains timezone placeholders like O P e I am aware of the 3rd parameter of DateTime::createFromFormat() to pass timezone information. - the documentation says 'Format accepted by date()' - DateTime is supposed to help parsing datetime formats, not to restrict Test script: --------------- $dt = DateTime::createFromFormat('[d/M/Y:H:i:s O]', '[13/Mar/1969:23:40:00 +0100]'); print($dt->format('c')); Expected result: ---------------- 1969-03-13T23:40:00+01:00 Actual result: -------------- Fatal error: Call to a member function format() on a non-object