note 72175 deleted from function.date-create by nlopess
| From: | nlopess@php.net | Date: | Fri, 05 Jan 2007 20:32:48 +0000 |
| Subject: | note 72175 deleted from function.date-create by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-121335@lists.php.net to get a copy of this message | ||
Note Submitter: Warren Stevens warbaby67 at gmail dot com
----
yes, as of 5.2 ...
New classes
===========
DateTime:
----
.code from 5.2 breaks on 5.1.4
$date = new DateTime("$_REQUEST[date]");
$date=$date->format("Y-m-d");
Fatal error: Class 'DateTime' not found in C:\htdocs\dev\time\lib\lib.inc.php on line 79
This comes up frequently since dates are rarely in the format mySQL likes, Y-m-d .. they either
come preformatted from some javascript or as separate $_REQUEST values and have to converted back
and forth.
I'm going to go back to unix timestamp then format the date with date(); There are too many
old versions of PHP installed on these web hosting servers.