Date/time types

Abstract

The date/time types that are supported by Sitecore

There are several different date/time types that can be displayed in the Sitecore UI or in reports. When you are working in a multi-instance, server environment that crosses multiple time zones, you should use these settings to ensure that your users see date and times consistently.

Local date/time

Local date/time is represented by an instance of the System.DateTime class that has a DateKind property equal to DateTimeKind.Local. This date/time is tied to the local time zone of the computer. It is returned by the System.DateTime.Now property. If you have a multi-instance CMS solution, you should avoid using local date/time.

Universal date/time

Universal date/time is represented by an instance of the System.DateTime class that has a DateKind property equal to DateTimeKind.Utc. This date/time is Coordinated Universal Time (UTC). All date/time values should be converted to universal time before saving them to the database. Converting to UTC ensures that users will see consistent date/time values no matter which server they are currently connected to in a multi-instance server environment.

Server date/time

Server date/time is represented by an instance of the System.DateTime class that has a DateKind property equal to DateTimeKind.Unspecified. This is a setting that lets administrators specify the server time zone. All date/time values stored in the database should be UTC, but date/time values in the User Interface (UI) should be displayed in server time. This means that all Sitecore applications and dialogs that display date/time values from the database and/or allow users to edit date/time values should be updated.

If an application displays data from the database, UTC date/time values should be first converted to server time in backend code and then server time values should be displayed in the UI. If the application allows users to enter or edit date/time values, new date/time values should be first converted from server time to UTC and then saved to the database.