[TYPO3-dev] new DateTime-Object
Steffen Kamper
steffen at sk-typo3.de
Thu Mar 27 12:18:59 CET 2008
"Jochen Rau" <j.rau at web.de> schrieb im Newsbeitrag
news:mailman.1.1206616354.26723.typo3-dev at lists.netfielders.de...
> Hi Steffen,
>
> I few weeks ago I changed the whole date handling of the extension
> "reservations" to the DateTime object. Actually it solves a lot of
> problems with timezones and supports an "object oriented way" dealing with
> dates.
>
> But it has also a lot of pitfalls and is not very comfortable to use. Most
> of these issues are discussed in the article you mentioned:
>
>> found a useful article about that too:
>> http://laughingmeme.org/2007/02/27/
>
> Some hints:
> 1. The method date_default_timezone_set('UTC') should be avoided, because
> it sets the default timezone for the rest of the script and therefore
> influences other extensions. (A solution can be to encapsulate your script
> and restore the timezone settings.)
> 2. It's not as easy as it should be to transform from unix-timestamps to a
> DateTime object. A possible solution can be found in the source of
> "reservations" (setting time to midnight):
> $dateObject = new DateTime(date('Y-m-d',$timestamp), new
> DateTimeZone('UTC'));
> 3. There is no handy way to say "set time to 00:00:00" without creating a
> new Object.
>
> Despite these handicaps, the DateTime object is a big progress in dealing
> with dates.
>
> Greetings
> Jochen
Hi Jochen,
thx for your hints!
vg Steffen
More information about the TYPO3-dev
mailing list