ID:               42698
 Comment by:       oliver at realtsp dot com
 Reported By:      david at palepurple dot co dot uk
 Status:           Open
 Bug Type:         Feature/Change Request
 Operating System: Linux
 PHP Version:      5.2.4
 New Comment:

this is an important feature in order to replace the functionality
provided by strptime (which is of course limited to the range of 32bit
timestamp).

without this feature the DateTime class cannot be used for rigorous
parsing of dates according to a specified format, such as is good
practice in forms validation where input of months and days can
otherwise be ambiguous (eg UK vs US date formats)


Previous Comments:
------------------------------------------------------------------------

[2007-09-18 08:52:32] david at palepurple dot co dot uk

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 this bug report at http://bugs.php.net/?id=42698&edit=1

Reply via email to