Bug #64975 [NEW]: createFromFormat Error parsing when AM PM not at the end

From: Date: Wed, 05 Jun 2013 11:16:16 +0000
Subject: Bug #64975 [NEW]: createFromFormat Error parsing when AM PM not at the end
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-179336@lists.php.net to get a copy of this message
From:             dimka212 at gmail dot com
Operating system: Windows
PHP version:      Irrelevant
Package:          Date/time related
Bug Type:         Bug
Bug description:createFromFormat Error parsing when AM PM not at the end

Description:
------------
$date = DateTime::createFromFormat('d M Y A h:i', '11 Mar 2013 PM 3:34');
Returns:   [12] => Unexpected data found.

Works only in this case:
$date = DateTime::createFromFormat('d M Y h:i A', '11 Mar 2013 3:34 PM');


Test script:
---------------
$date = DateTime::createFromFormat('d M Y A h:i', '11 Mar 2013 PM 3:34');
if(!$date) echo 'Doesn\'t work =(';

Expected result:
----------------
Returns DateTime object

Actual result:
--------------
False
(Unexpected data found.)

-- 
Edit bug report at https://bugs.php.net/bug.php?id=64975&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=64975&r=trysnapshot54
Try a snapshot (PHP 5.3):   https://bugs.php.net/fix.php?id=64975&r=trysnapshot53
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=64975&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=64975&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=64975&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=64975&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=64975&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=64975&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=64975&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=64975&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=64975&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=64975&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=64975&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64975&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=64975&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=64975&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=64975&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64975&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=64975&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=64975&r=mysqlcfg



Thread (6 messages)

« previous php.bugs (#179336) next »