From:             
Operating system: *
PHP version:      5.3SVN-2010-05-20 (SVN)
Package:          Date/time related
Bug Type:         Bug
Bug description:DateTime::createFromFormat does not match documentation

Description:
------------
The manual for DateTime::createFromFormat says: 



 Format accepted by date().



If format does not contain the character ! then portions of the date/time
value specified in format but not specified in time will be set to the
current system time. 



However if you specify format like "d-m-Y H:i" and provide datetime string
that does not contain time, parsing would fail - even though the manual
says if time string does not contain parts from format it should use
current system.



Test script:
---------------
<?php



$date = DateTime::createFromFormat("d-m-Y H:i", "25-10-2007");

var_dump($date);



Expected result:
----------------
Something like:

object(DateTime)#1 (3) {

  ["date"]=>

  string(19) "2007-10-25 18:58:31"

  ["timezone_type"]=>

  int(3)

  ["timezone"]=>

  string(19) "America/Los_Angeles"

}





Actual result:
--------------
bool(false)

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

Reply via email to