[TYPO3-mvc] f:format.date timezone "problem"?

Christian Zenker christian.zenker at 599media.de
Wed Jul 28 15:58:09 CEST 2010


Hi Xavier.

I stumbled upon that recently, too.

If you enter a date in the TYPO3 backend it will store the timestamp of  
midnight in the timezone you are in the database.
When using the @-syntax in DateTime UTC (=GMT) will be assumed as the  
timezone of that DateTime syntax. So if you use format() it will render  
the date assuming UTC timezone.

To fix this you can either write a custom view helper that handles this or  
you let your object return DateTime-Objects that you configure correctly  
before.

Christian.

On Wed, 28 Jul 2010 11:59:15 +0200, Xavier Perseguers  
<typo3 at perseguers.ch> wrote:

> Hi,
>
> Just found out something funny (still I'll have to find a trick or  
> understand it fully):
>
> I have a TCA with a date field (thus in BE). It stores value as a Unix  
> timestamp:
>
> 1255125600
>
> That is, 10.10.2009 00:00
>
> Then I display it with Fluid:
>
> <f:format.date format="d.m.Y">@{myobject.date}</f:format.date>
>
> and I get "09.10.2009" instead. I guess DateTime is using a time offset  
> corresponding to the server because if I add the time:
>
> <f:format.date format="d.m.Y H:i">@{myobject.date}</f:format.date>
>
> I get
>
> 09.10.2009 22:00
>
> Which part is responsible for this problem?
>
> :-)
>
> Xavier


More information about the TYPO3-project-typo3v4mvc mailing list