Sitecore 8 ServerTimeZone – my dates are all wrong

This issue appeared when I upgraded from Sitecore 7.5 to Sitecore 8. Suddenly my dates on the website were 2 hours behind – on my development server it was one hour behind.

In Sitecore, my date-time was (example) 2015-04-12 00:00:00. This date was presented as 2015-04-11 22:00:00+2.

The issue arises, because Sitecore have implemented a feature that tries to handle local time zones on the server. Old Sitecore 7.5 dates are stored without any timezone information:

  • 20150412T000000

In Sitecore 8, Sitecore have changed the raw data format of the date field by taking the timezone into consideration. Which in my case means that my 2014-04-12 00:00:00 becomes 2015-04-11 22:00:00:

  • 20150411T220000Z

Notice the “Z” at the end? This implies that this is a datetime that have a timezone, and the timezone is now 2 hours behind UTC.

To fix the old datetime fields, I need to tell Sitecore which timezone non-timezone-datetime fields have. This is the setting, ServerTimeZone:

<setting name="ServerTimeZone" value="UTC" />

I also needed to update the Lucene index, as the invalid datetime was added to the index as well.

Thanks to Peter Wind who helped find this issue.


About briancaos

Developer at Pentia A/S since 2003. Have developed Web Applications using Sitecore Since Sitecore 4.1.
This entry was posted in Sitecore 8 and tagged , , . Bookmark the permalink.

7 Responses to Sitecore 8 ServerTimeZone – my dates are all wrong

  1. Bryan P says:

    Just ran into this issue myself! Thanks for the heads up.

  2. Thanks – stumbled into this as well

  3. Pingback: Hands on Sitecore 8: 3 versteckte Highlights – Sitecore

  4. Thanks. Me too – just hit this on a 6.5 to 8 migration.

  5. Christian Willumsen says:

    Thanks for this, damn annoying they changed it. I mean I can understand why, but ruining existing stuff is not fun. Couldn’t they have made a new field type that is timezone aware and not mess with upgraded stuff?

    And since UTC does not observe daylight savings won this cause issues when the server changes the time automatically? Won’t things suddenly be 1 hour off again?

  6. Nikolaj says:

    Is this correct? According to Sitecore this setting

    So it is used to convert UTC to localtimes and the other way around I figure.

  7. Sen says:

    Great Just helped me solve one of the issue!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s