- 3 minutes to read
This document describes the role of time zones for correct time representation within ASPxScheduler.
Time zone information is used to calculate start and end times for an appointment if the time zone of the web server (where the server part of ASPxScheduler operates) is different form the time zone in which ASPxScheduler client scripts are executed. Time zone calculations are illustrated in the picture below. You can find a detailed explanation of ASPxScheduler time zones in the text that follows the picture.
Server Time Zone
The ASPxScheduler server part obtains time zone information from the time zone of the web server where the APS.NET application runs. It defaults to the time zone of the server OS.
You can specify time zone explicitly for your application by using the SchedulerStorageBase.TimeZoneId property. When the DateTime data are retrieved or stored from/to the data source, time zone conversions are not performed.
In the picture illustrating the time zone calculation you can see that 1 PM in the database is interpreted as 1 PM Pacific Standard Time and translated to 4 PM for the Eastern Time Zone.
Client Time Zone
By default, the client time zone is assumed to be the same as the server time zone. The client time zone is the time zone in which the ASPxScheduler client scripts operate. User will see views, appointments and appointment dialogs displaying data translated to the Client Time Zone.
In the picture above the client time zone is Eastern Time, and an appointment with a start time of 1 PM is displayed as if it starts at 4 PM. The difference is 3 hours, which corresponds to the difference between Los Angeles (server-side) and New York (client-side).
The SchedulerOptionsBehaviorBase.ClientTimeZoneId property is used to specify the client time zone. It can be accessed via the ASPxScheduler.OptionsBehavior.ClientTimeZoneId notation. You can specify a ClientTimeZoneId value for each user individually when the user is logged in to the application.
Web Browser Time Zone
You should specify the ClientTimeZoneId explicitly because ASPxScheduler has no method to detect a web browser’s time zone.
The client time zone defaults to the server time zone, and should be set via the ClientTimeZoneId as described in the previous section or specified by the user. Since ASPxScheduler cannot guess in what time zone the browser is, the user can help to identify the correct time zone.
The ASPxTimeZoneEdit control is implemented to enable the end-user to accomplish this task.
You can see it in the picture at the beginning of this article as the drop-down box displaying (UTC -05:00) Eastern Time (US & Canada). With the help of this control, end-users can set the client time zone manually as needed.
The Scheduler supports “floating” time zone (time zone independent) all-day appointments. “Floating” means that their time is independent of the client time zone. Let’s take a typical example of a “floating” all-day appointment - it is the New Year’s Day. It starts at midnight January 1 in any time zone. Therefore, it does not start simultaneously throughout the world - it starts at different moments according to the time zone where the client is located.
All-day appointments (appointments with the Appointment.AllDay property set to
true) are always treated as if they belong to a “floating” time zone.
However, to perform a centralized action (for example, to restart a server at a pilot factory, resulting in a break in connectivity between departments ), the appointment should occur only once, at a different time in each applicable time zone. In this case, a regular appointment is used, not a “floating” appointment.