Skip to main content

TimeOfDayInterval.ToTimeInterval() Method

Converts the TimeOfDayInterval value to the TimeInterval type.

Namespace: DevExpress.XtraScheduler

Assembly: DevExpress.XtraScheduler.v24.1.Core.dll

NuGet Package: DevExpress.Scheduler.Core

Declaration

public TimeInterval ToTimeInterval()

Returns

Type Description
TimeInterval

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

Remarks

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

Example

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