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

Christian Zenker christian.zenker at 599media.de
Tue May 3 11:37:05 CEST 2011


Hi there.
> Hi,
> Using TYPO3 4.5.2 on a linux machine in Germany with PHP 5.2 and the  
> following settings in the install tool:
>
> $TYPO3_CONF_VARS['SYS']['phpTimeZone'] = 'Europe/Berlin';
> $TYPO3_CONF_VARS['SYS']['serverTimeZone'] = '2';
>
> this STILL does not work for me.
> I know that it is only possiblt to set the timezone with PHP 5.3 but  
> what about the serverTimeZone variable?

According to the Install Tool [SYS][serverTimeZone] "can be used in  
extensions (!) [...]", so I don't think the core even uses it. After all,  
I don't even see, why an extension should use it - if you have daylight  
saving times, this would change over the course of the year...
Just a side question: Where did you read that the timezone could not be  
set in PHP 5.2? I could not find it.

>
> When calling this directly in a php file, i get the correct output:
>
> <?php
>
> function render($date = NULL, $format = 'Y-m-d') {
> 	if ($date === NULL) {
> 		echo "render children";
> 		if ($date === NULL) {
> 			return '';
> 		}
> 	}
> 	if (!$date instanceof DateTime) {
> 		try {
> 			$date = new DateTime($date);
> 		} catch (Exception $exception) {
> 			echo "error";
> 		}
> 	}
> 	return $date->format($format);
> }
> 	
> echo render('2011-04-27 00:00:00', 'd.m.Y')	
> ?>
>
> When calling the same via fluid helper, i get the wrong result  
> (26.4.2011) so what is going on in fluid/extbase here?
>
> The input into the fluid template is a string: '2011-04-29 00:00:00' and  
> not an object.
>

Obviously some timezones get mixed up here.

Could you please do some tests with your plain function as well as with  
the viewHelper?
Always use 'r' as format(!) and try:

'2011-04-27 00:00:00',
'2011-04-27 00:00:00Europe/Berlin' and
'2011-04-27 00:00:00UTC'

The first line should give you the default timezone of your installation.

Then another question: Where does the string, you are giving the fluid  
ViewHelper come from? From a domain model or is it hardcoded? I'm not yet  
certain, who is to blame for the error...

After all, if you have access to the servers config, you could set  
Europe/Berlin as default in php.ini. This works at least for me.

Christian.


More information about the TYPO3-project-typo3v4mvc mailing list