Re: [PHP] DateTime... What else ?

2008-04-17 Thread Stut

On 17 Apr 2008, at 10:05, David BERCOT wrote:

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
bFatal error/b:  Class 'DateTime' not found in
b/var/www2/dacg_visio/index.html/b on line b244/bbr /
/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 ?


Pre-5.2 you need to explicitly say you want the DateTime class. See  
the note on this page: http://fr3.php.net/manual/fr/datetime.installation.php


Also note that it's experimental at the moment and therefore not  
recommended for production usage.


-Stut

--
http://stut.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] DateTime... What else ?

2008-04-17 Thread Simon Welsh


On 17/04/2008, at 9:05, David BERCOT wrote:

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
bFatal error/b:  Class 'DateTime' not found in
b/var/www2/dacg_visio/index.html/b on line b244/bbr /
/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.


--  
PHP General Mailing List (http://www.php.net/)

To unsubscribe, visit: http://www.php.net/unsub.php




?php
$mois_en_cours1 = date('Y-m', strtotime('-1 month'));
$mois_en_cours2 = date('Y-m', strtotime('-2 month'));
$mois_en_cours3 = date('Y-m', strtotime('-3 month'));
?

---
Simon Welsh
Admin of http://simon.geek.nz/

Windows is a joke operating system. Hell, it's not even an operating  
system. NT is Not Tough enough for me either. 95 is how may times it  
will crash an hour.


http://www.thinkgeek.com/brain/gimme.cgi?wid=81d520e5e



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] DateTime... What else ?

2008-04-17 Thread David BERCOT
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
bFatal error/b:  Class 'DateTime' not found in
b/var/www2/dacg_visio/index.html/b on line b244/bbr /
/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.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] DateTime... What else ?

2008-04-17 Thread David BERCOT
Hi again,

Le Thu, 17 Apr 2008 21:10:44 +1200,
Simon Welsh [EMAIL PROTECTED] a écrit :
 On 17/04/2008, at 9:05, David BERCOT wrote:
  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
  bFatal error/b:  Class 'DateTime' not found in
  b/var/www2/dacg_visio/index.html/b on line b244/bbr /
  /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.
 
 ?php
 $mois_en_cours1 = date('Y-m', strtotime('-1 month'));
 $mois_en_cours2 = date('Y-m', strtotime('-2 month'));
 $mois_en_cours3 = date('Y-m', strtotime('-3 month'));
 ?

Great ;-)

Thank you very much !

David.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] DateTime... What else ?

2008-04-17 Thread David BERCOT
Le Thu, 17 Apr 2008 10:19:10 +0100,
Stut [EMAIL PROTECTED] a écrit :
 On 17 Apr 2008, at 10:05, David BERCOT wrote:
  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
  bFatal error/b:  Class 'DateTime' not found in
  b/var/www2/dacg_visio/index.html/b on line b244/bbr /
  /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 ?
 
 Pre-5.2 you need to explicitly say you want the DateTime class. See  
 the note on this page:
 http://fr3.php.net/manual/fr/datetime.installation.php
 
 Also note that it's experimental at the moment and therefore not  
 recommended for production usage.

OK. So, my error is normal !!!

Thank you very much.

David.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php