Date/time conversions

Abstract

Converting dates and times

The Sitecore UTC implementation handles multi-instance CMS solutions that are spread across different time zones. There are both methods and attribute settings that control how date/time values are displayed.

The following helper methods in the Sitecore.DateUtil class handle all new date/time conversion operations:

  • .ToUniversalTime – converts server date and time to universal time.

  • .ToServerTime – converts universal date and time to the server time.

You can use the following attributes to work with date/time conversions:

  • Sitecore.Utc – indicates that the selected symbol is a UTC date/time with DateTime.Kind set to DateTimeKind.Utc.

Sitecore.ServerTime – indicates that the selected symbol is a date/time in the server time zone with DateTime.Kind set to DateTime.Kind.Unspecified.