note 72175 added to function.date-create
| From: | WarrenStevenswarbaby67 at gmail dot com | Date: | Fri, 05 Jan 2007 17:10:42 +0000 |
| Subject: | note 72175 added to function.date-create | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-121326@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 64.71.164.2
Probable Submitter: 70.115.162.220
----
Manual Page -- http://www.php.net/manual/en/function.date-create.php
Edit -- https://master.php.net/note/edit/72175
Del: integrated -- https://master.php.net/note/delete/72175/integrated
Del: useless -- https://master.php.net/note/delete/72175/useless
Del: bad code -- https://master.php.net/note/delete/72175/bad+code
Del: spam -- https://master.php.net/note/delete/72175/spam
Del: non-english -- https://master.php.net/note/delete/72175/non-english
Del: in docs -- https://master.php.net/note/delete/72175/in+docs
Del: other reasons-- https://master.php.net/note/delete/72175
Reject -- https://master.php.net/note/reject/72175
Search -- https://master.php.net/manage/user-notes.php