#42698 [NEW]: date parsing in DateTime / date_parse - accept optioanl format
| From: | david at palepurple dot co dot uk | Date: | Tue, 18 Sep 2007 08:52:32 +0000 |
| Subject: | #42698 [NEW]: date parsing in DateTime / date_parse - accept optioanl format | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-117624@lists.php.net to get a copy of this message | ||
From: david at palepurple dot co dot uk
Operating system: Linux
PHP version: 5.2.4
PHP Bug Type: Feature/Change Request
Bug description: date parsing in DateTime / date_parse - accept optioanl format
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.
--
Edit bug report at http://bugs.php.net/?id=42698&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42698&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42698&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42698&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=42698&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=42698&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=42698&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=42698&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=42698&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=42698&r=support
Expected behavior: http://bugs.php.net/fix.php?id=42698&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=42698&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=42698&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=42698&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42698&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=42698&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=42698&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=42698&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=42698&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=42698&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=42698&r=mysqlcfg