DateTime_fix_createFromFormat.phpt [plain text]
--TEST--
Test fix for DateTime when date have textual day with dot or other special char at end
--FILE--
<?php
date_default_timezone_set('Europe/London');
echo "*** Testing clone on DateTime objects ***\n";
$orig = new DateTime('2012-11-29 17:00:00');
$string = "Thu., Nov. 29, 2012 5:00PM";
$fromFormat = DateTime::createFromFormat( "D., M# j, Y g:iA", $string );
echo "Format method: " . $orig->format("D., M. j, Y g:iA") . "\n";
echo "createFromFormat method: " . $fromFormat->format("D., M. j, Y g:iA") . "\n";
?>
===DONE===
--EXPECTF--
*** Testing clone on DateTime objects ***
Format method: Thu., Nov. 29, 2012 5:00PM
createFromFormat method: Thu., Nov. 29, 2012 5:00PM
===DONE===