chez free : Class 'DateTime' not found
Le
unbewusst.sein
Chez free, j'ai l'erreur suivante :
Fatal error: Class 'DateTime' not found in
/mnt/168/sda/3/3/studio.quatorze/landp_public/landp_pdo_item_test.php on
line 53
ligne 53 étant dans cette fonction :
function isodate2fr_FR($isodatestring){
date_default_timezone_set('Europe/Paris');
$date_format='%A %d %B %Y à %Hh %M:%S';
$atime=new DateTime($isodatestring);// Ligne 53
setlocale(LC_TIME,'fr_FR.utf-8');
return strftime($date_format, $atime->format('U'));
}
ça peut se remplacer ? tout en restant compatible avec le php sur mac OS
X Lion :
PHP Version 5.3.6
celuis sur free étant :
PHP Version 5.1.3RC4-dev
--
« L'amour, c'est offrir à quelqu'un qui n'en veut pas
quelque chose que l'on n'a pas. »
(Jacques Lacan)
Fatal error: Class 'DateTime' not found in
/mnt/168/sda/3/3/studio.quatorze/landp_public/landp_pdo_item_test.php on
line 53
ligne 53 étant dans cette fonction :
function isodate2fr_FR($isodatestring){
date_default_timezone_set('Europe/Paris');
$date_format='%A %d %B %Y à %Hh %M:%S';
$atime=new DateTime($isodatestring);// Ligne 53
setlocale(LC_TIME,'fr_FR.utf-8');
return strftime($date_format, $atime->format('U'));
}
ça peut se remplacer ? tout en restant compatible avec le php sur mac OS
X Lion :
PHP Version 5.3.6
celuis sur free étant :
PHP Version 5.1.3RC4-dev
--
« L'amour, c'est offrir à quelqu'un qui n'en veut pas
quelque chose que l'on n'a pas. »
(Jacques Lacan)

Poser une question


Dans les commentaires de la doc php
(http://www.php.net/manual/fr/class.datetime.php) :
<?php
if (!class_exists('DateTime')) {
class DateTime {
public $date;
public function __construct($date) {
$this->date = strtotime($date);
}
public function setTimeZone($timezone) {
return;
}
private function __getDate() {
return date(DATE_ATOM, $this->date);
}
public function modify($multiplier) {
$this->date = strtotime($this->__getDate() . ' ' . $multiplier);
}
public function format($format) {
return date($format, $this->date);
}
}
}
?>
cordialement,
Anthony
OK, c'est clair, merci bien !
--
Une Bévue