DateTime... What else ?
| From: | David BERCOT | Date: | Thu, 17 Apr 2008 09:05:44 +0000 |
| Subject: | DateTime... What else ? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-273152@lists.php.net to get a copy of this message | ||
Hi,
I've got a problem with DateTime. I have a short code which gives an
error :
<CODE>
$date = new DateTime(date("d/m/Y"));
$date->modify("-1 month");
$mois_en_cours1 = $date->format("Y-m");
$date->modify("-1 month");
$mois_en_cours2 = $date->format("Y-m");
$date->modify("-1 month");
$mois_en_cours3 = $date->format("Y-m");
</CODE>
<ERROR>
<b>Fatal error</b>: Class 'DateTime' not found in
<b>/var/www2/dacg_visio/index.html</b> on line <b>244</b><br />
</ERROR>
If I look at the documentation :
http://fr3.php.net/manual/fr/function.date-modify.php
it seems to work if PHP version is above 5.1.0 (I am in 5.1.6 !).
Do you have any idea about this error (Debian/Apache2) ?
Do you have another way to obtain $mois_en_cours1, 2, 3 without
DateTime ?
Thank you very much.
David.