Skip to main content

TimeOfDayInterval.ToTimeInterval(DateTime) Method

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

Namespace: DevExpress.XtraScheduler

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

Declaration

public TimeInterval ToTimeInterval(
    DateTime date
)

Parameters

Name Type Description
date DateTime

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

Returns

Type Description
TimeInterval

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

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