[TYPO3-dev] new DateTime-Object

Steffen Kamper steffen at sk-typo3.de
Wed Mar 26 17:13:48 CET 2008


"Steffen Kamper" <steffen at sk-typo3.de> schrieb im Newsbeitrag 
news:mailman.1.1206547453.26651.typo3-dev at lists.netfielders.de...
> Hi,
>
> may be it's useful for you, may be it's useful for core also.
>
> With php5 there is a new Object that makes it a lot easier to handle 
> dates.
>
> some examples:
>
> $date = new DateTime( "2007-08-11 14:32:18", new DateTimeZone( 'CET' ) );
> echo $date->format( "d.m.Y H:i:s" ); // output: 11.08.2007 14:32:18
>
> $date_start = new DateTime( 'today' );
> $date_end  = clone $date_start;
> $date_end->modify( '7 days' );
>
> if ($date_end->format( "U" )  > $date_start->format( "U" )) {
>    echo "End date is in future!";
> } else {
>    echo "End date is in past!";
> }
> vg  Steffen
>

found a useful article about that too:
http://laughingmeme.org/2007/02/27/

vg  Steffen 






More information about the TYPO3-dev mailing list