Re: [PHP] DateInterval

2009-04-30 Thread MIke Alaimo

Ah.  This makes perfect sense.  Good idea.

Mike

Raymond Irving wrote:


--- On Wed, 4/29/09, MIke Alaimo  wrote:
  

Raymond, have you tried using DateTime::modify?  It
appears to work like strtotime.
also DateTime::format works like date.  At least as
far as I can tell.





From the little documentation that I've seen it appears that it's similar to 
strtotime and date but it would be very good if the PHP devs could make 
strtotime() and date() become wrappers for DateTime::modify and 
DateTime::format. This way we dont hae to modify our code when moving to a 
version of PHP that supports the new DateTime class.

__
Raymond Irving

  



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



Re: [PHP] DateInterval

2009-04-29 Thread Raymond Irving



--- On Wed, 4/29/09, MIke Alaimo  wrote:
> 
> Raymond, have you tried using DateTime::modify?  It
> appears to work like strtotime.
> also DateTime::format works like date.  At least as
> far as I can tell.
> 


From the little documentation that I've seen it appears that it's similar to 
strtotime and date but it would be very good if the PHP devs could make 
strtotime() and date() become wrappers for DateTime::modify and 
DateTime::format. This way we dont hae to modify our code when moving to a 
version of PHP that supports the new DateTime class.

__
Raymond Irving

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



Re: [PHP] DateInterval

2009-04-29 Thread MIke Alaimo

Here is something i'd like to point out with DateInterval.

$dInt = 'PT4320S';
$d = new DateInterval($dInt);
var_dump($d);
$dz = new DateTimeZone(UTC);
$dt = new DateTime('now',$dz);
$dt->add($d);
var_dump($dt->format(DATE_ATOM));

It appears that running this code fails when it seems like it should work.

$dInt = 'PT43200S';
$d = new DateInterval($dInt);
var_dump($d);
$dz = new DateTimeZone(UTC);
$dt = new DateTime('now',$dz);
$dt->add($d);
var_dump($dt->format(DATE_ATOM));


Please note the first value in $dInt should be 72 minutes, while the 
later should be 720 minutes or half of a day


The PT12H  interval seems to work fine.

$dInt = 'PT12H';
$d = new DateInterval($dInt);
var_dump($d);
$dz = new DateTimeZone(UTC);
$dt = new DateTime('now',$dz);
$dt->add($d);
var_dump($dt->format(DATE_ATOM));


Raymond, have you tried using DateTime::modify?  It appears to work like 
strtotime.

also DateTime::format works like date.  At least as far as I can tell.


Mike

Raymond Irving wrote:

Sounds great Mike.

I personally would also like to see standard date/time functions 
(strtotime, strftime, date, etc) support dates greater than 2038. I 
think this can be done internally by parsing the datetime value swith 
the DateInterval object and retuning the results to the standard 
functions.


Best regards,
__
Raymond Irving


--- On *Wed, 4/29/09, MIke Alaimo //* wrote:


From: MIke Alaimo 
Subject: [PHP] DateInterval
To: php-general@lists.php.net
Date: Wednesday, April 29, 2009, 8:53 PM

Hello,

I would like to know how to correctly use DateInterval::format(). 
The documentation is unclear.


Also, I am willing to write some documentation for the
DateInterval and DatePeriod if no one has taken the task.

Thanks for the help.

Mike

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




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



Re: [PHP] DateInterval

2009-04-29 Thread Raymond Irving
Sounds great Mike.

I personally would also like to see standard date/time functions (strtotime, 
strftime, date, etc) support dates greater than 2038. I think this can be done 
internally by parsing the datetime value swith the DateInterval object and 
retuning the results to the standard functions.

Best regards,
__
Raymond Irving


--- On Wed, 4/29/09, MIke Alaimo  wrote:

From: MIke Alaimo 
Subject: [PHP] DateInterval
To: php-general@lists.php.net
Date: Wednesday, April 29, 2009, 8:53 PM

Hello,

I would like to know how to correctly use DateInterval::format().  The 
documentation is unclear.

Also, I am willing to write some documentation for the DateInterval and 
DatePeriod if no one has taken the task.

Thanks for the help.

Mike

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