Skip to main content

Specify Time Zones

  • 3 minutes to read

The DevExpress Scheduler for Xamarin.Forms supports time zones. You can specify the time zone information for the entire scheduler and individual appointments.

Scheduler Time Zone

The scheduler uses the mobile device’s time zone (TimeZoneInfo.Local) for appointments.

You can use the SchedulerDataStorage.TimeZone property to specify the time zone for the appointments saved in the scheduler’s data storage. A scheduler view uses the time zone of the data storage it is bound to.

The TimeZoneInfo objects specify the scheduler’s time zone information. Use the IANA time zone names (for example, America/New_York) to access the TimeZoneInfo objects and assign these objects to the corresponding properties of the scheduler/appointment.

Note

The scheduler cannot read the TimeZoneInfo instances that the CreateCustomTimeZone method created.

The code sample below shows how to specify the time zone of the scheduler’s data storage in XAML:

<dxsch:WorkWeekView>
    <dxsch:WorkWeekView.DataStorage>
        <dxsch:SchedulerDataStorage TimeZone="America/New_York">
                <!--...-->
        </dxsch:SchedulerDataStorage>
    </dxsch:WorkWeekView.DataStorage>
</dxsch:WorkWeekView>

Appointment Time Zone

Use the AppointmentItem.TimeZoneId property to specify the time zone for a particular appointment. In a scheduler view, an appointment’s time is calculated based on the appointment’s and scheduler’s time zones.

For example, the scheduler storage’s time zone is set to Los Angeles (the SchedulerDataStorage.TimeZone is “America/Los_Angeles”, UTC-08). A scheduler view bound to this storage uses this time zone to display appointments. An appointment scheduled from 4PM to 5PM New York time (the AppointmentItem.TimeZoneId is “America/New_York”, UTC-05) is then displayed as 1PM to 2PM Los Angeles time.

When appointments with different time zones are saved to the data source, their time/date values cannot be converted correctly and compared independently without time zone information. The DataSource.DateTimeSavingMode property defines which time zone information to use when saving appointments to the data source. If this property is set to Storage, appointment date/time values are converted to the storage’s time zone and subsequently written to the appointment’s data record, and all date/time values are saved in the same time zone.

All-Day Appointments

All-day appointments (appointments with the AppointmentItem.AllDay property set to true) are always treated as “floating” time zone (the time is independent from the client’s time zone) appointments, for example, New Year’s Day. It starts at midnight on January 1st in any time zone, but it does not start simultaneously throughout the world.

To schedule an event that occurs only once at a different time in multiple time zones, use a regular appointment.

Time Zones in the Edit Appointment Form

Specify the AppointmentMapping.TimeZoneId mapping to enable users to change the appointment’s time zone in the Edit Appointment form.

Edit Appointment Form - Time Zone