2

I have a mechanism that is automatically creating content items and setting dates accordingly. Dates are being set in UTC by the code.

For my local development machine, I am in the central timezone (CST). All dates that are displayed to me appear to be in the central timezone, but are in fact stored as UTC. This seems correct.

On my development server, however, the operating system is in UTC time. I have noticed that when I login to the CMS on the server, dates are displayed to me in UTC time.

What is the proper way to adjust the display of dates so that they are displayed to the user in CST from the server? Is setting <setting name="ServerTimeZone" value="600"/> enough, and what other repercussions will occur if I set this value?

5

Looks like you are in the right direction.

1) The ServerTimeZone config needs to be set to match your timezone.

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

2) If you are running versions earlier than Sitecore 9.0, make sure you didn't change the default value (false) of this setting. Keeping it as false will display local server time zone in analytics reports

<setting name="Analytics.Reports.DisplayDatesInUtc" value="false" />

3) In your codes which creates content, continue storing your date/time in UTC format. This way, date/time in your database is always in UTC, and the ServerTimeZone setting merely changes how it is being converted and displayed in local time.

You can find more details in these 2 links

https://doc.sitecore.com/developers/90/sitecore-experience-management/en/settings-supporting-utc-implementation.html

https://doc.sitecore.com/developers/90/sitecore-experience-management/en/storing-date-time-values-in-databases.html

| improve this answer | |
0

ServerTimeZone does indeed need to be set, but it must be from the second column of the Microsoft doc here:

https://docs.microsoft.com/en-us/previous-versions/windows/embedded/gg154758(v=winembedded.80)?redirectedfrom=MSDN

In your case it would need to be:

<setting name="ServerTimeZone" value="Central Standard Time"/>
| improve this answer | |
0

I think in your Sitecore configuration you need to set below two things to as per your requirement(The timezone which you want) of time required and then hope that will resolve this issue.

<setting name="ServerTimeZone" value="Value for your timezone"/> 

<globalization requestEncoding="utf-8" responseEncoding="utf-8" />

Note:

  1. Make a patch file for this.
  2. If you are using Azure PaaS then you may also need to add below Application setting in your configuration of App service.
  3. Use this link for Timezone values.
  4. You need to use Name of Time Zone column from above link to get the values of timezone.

    WEBSITE_TIME_ZONE =”Value for your timezone”

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.