Fox
Fox

Reputation: 633

How can I get a correct publish date in TYPO3?

I am using TYPO3 7.6.9 and want to use the publish date and expiration date options for content elements in TYPO3, but currently this is not working correctly for me, because the time part seems to be incorrect.

For example:

If I set the publish date to: 18:00 04-09-2016 and the real time is 19:00 04-09-2016 then the element is not visible in frontend. For this reason I have checked some values and it seems that there is a two hour difference to the real time, because 17:00 04-09-2016 is working.

Furthermore I have set the timezone via install tool to UTC and I think that is the problem:

[SYS][phpTimeZone] = UTC

I have set the timezone to UTC because I got a two hour difference by using the timezone "Europe/Berlin" and different datetime objects in an extension. I could fix this by set the timezone to UTC, but now I got in trouble with the publish and expiration options.

Is there a solution to get both to work?

Upvotes: 1

Views: 1020

Answers (2)

Andreas Wolf
Andreas Wolf

Reputation: 1065

The caveat here is that the dates you enter in the backend are UTC, not your local timezone. This is not sooo well documented, but trust me, I debugged that stuff last week ;-)

The dates are stored in your server’s timezone, so be cautious with changing the timezone after the fact—this might break existing dates!

The effect you observed is actually exactly what happens when you are in CEST (UTC+2):

  1. you create a content element and set its publication time to 17:00 (UTC)
  2. you visit the page at 17:01 CEST (15:01 UTC) -> the content is not visible
  3. you visit the page at 19:01 CEST (17:01 UTC) -> the content is visible

Upvotes: 0

Claus Due
Claus Due

Reputation: 4261

Make sure you also define the time zone in PHP's configuration (date.timezone). You should also, but are not required to, properly set your system time zone.

Upvotes: 1

Related Questions