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

TimeOfDayInterval.ToTimeInterval(DateTime) Method

Converts the TimeOfDayInterval value to the TimeInterval type starting from the specified date.

Namespace: DevExpress.XtraScheduler

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


public TimeInterval ToTimeInterval(
    DateTime date
Public Function ToTimeInterval(
    date As Date
) As TimeInterval


Name Type Description
date DateTime

A DateTime value representing the start date for the new time interval value.


Type Description

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


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