A newer version of this page is available. Switch to the current version.

TimeOfDayInterval.ToTimeInterval() Method

Converts the TimeOfDayInterval value to the TimeInterval type.

Namespace: DevExpress.XtraScheduler

Assembly: DevExpress.XtraScheduler.v18.2.Core.dll


public TimeInterval ToTimeInterval()
Public Function ToTimeInterval As TimeInterval


Type Description

A TimeInterval value representing the time interval which corresponds to this "time of day" interval.


Note: To set the start date for the returned TimeInterval value the overloaded TimeOfDayInterval.ToTimeInterval method should be used.


This example demonstrates how the TimeOfDayInterval object can be converted to a TimeInterval object. To do this the TimeOfDayInterval.ToTimeInterval method is used.

The initial TimeOfDayInterval value:

09:35:00 - 12:54:00 [03:19:00]

Converted to TimeInterval:

1/1/0001 9:35:00 - 1/1/0001 12:54:00 [03:19:00]

Converted to TimeInterval with July 17, 2010 as the start date parameter:

17/7/2010 9:35:00 - 17/7/2010 12:54:00 [03:19:00]

Use the following code to achieve these results.

using DevExpress.XtraScheduler;
// ...

// Initialize a new "time-of-day" interval.
// Start = 9:35. End = 12:54.
TimeOfDayInterval tOfDayInterval = new TimeOfDayInterval(new TimeSpan(9, 35, 0), 
    new TimeSpan(12, 54, 0));

// Convert to time interval starting from DateTime.MinValue.
textBox1.Text = tOfDayInterval.ToTimeInterval().ToString();

// Convert to time interval starting from the specified date (July 17, 2010).
textBox2.Text = tOfDayInterval.ToTimeInterval(new DateTime(2010, 7, 17)).ToString();
See Also