New to Telerik UI for WPFStart a free 30-day trial

Represents date time duration in days and/or months.

Definition

Namespace:Telerik.Windows.Controls.ScheduleView

Assembly:Telerik.Windows.Controls.ScheduleView.dll

Syntax:

C#
[TypeConverter(typeof(DateTimeIntervalConverter))]
public struct DateTimeInterval : IEquatable<DateTimeInterval>

Implements: IEquatable<DateTimeInterval>

Inherited Members ValueType.ToString()

Constructors

Initializes a new instance of the DateTimeInterval struct.

C#
public DateTimeInterval(int minutes, int hours, int days, int months, int weeks)
Parameters:minutesint

The minutes.

hoursint

The hours.

daysint

The days.

monthsint

The months.

weeksint

The weeks.

Initializes a new instance of the DateTimeInterval struct.

C#
public DateTimeInterval(int hours, int days, int months, int weeks)
Parameters:hoursint

The hours.

daysint

The days.

monthsint

The months.

weeksint

The weeks.

Initializes a new instance of the DateTimeInterval struct.

C#
public DateTimeInterval(int days, int months, int weeks)
Parameters:daysint

The days.

monthsint

The months.

weeksint

The weeks.

Initializes a new instance of the DateTimeInterval struct.

C#
public DateTimeInterval(int days, int months)
Parameters:daysint

The days.

monthsint

The months.

Fields

Identifies DateTimeInterval of zero duration.

C#
public static readonly DateTimeInterval Zero

Properties

Gets the days.

C#
public int Days { get; }
Property Value:

The days.

Gets the hours.

C#
public int Hours { get; }
Property Value:

The hours.

Gets the minutes.

C#
public int Minutes { get; }
Property Value:

The minutes.

Gets the months.

C#
public int Months { get; }
Property Value:

The months.

Methods

Converts the given DateTimeInterval to TimeSpan.

C#
public static TimeSpan ConvertToTimeSpan(DateTimeInterval interval)
Parameters:intervalDateTimeInterval

DateTimeInterval.

Returns:

TimeSpan

TimeSpan.

Indicates whether this instance and a specified DateTimeInterval are equal.

C#
public bool Equals(DateTimeInterval other)
Parameters:otherDateTimeInterval

Another DateTimeInterval to compare to.

Returns:

bool

True if other and this instance are the same type and represent the same value; otherwise, false.

Implements: IEquatable<DateTimeInterval>.Equals(DateTimeInterval)

Indicates whether this instance and a specified object are equal.

C#
public override bool Equals(object obj)
Parameters:objobject

Another object to compare to.

Returns:

bool

True if obj and this instance are the same type and represent the same value; otherwise, false.

Overrides: ValueType.Equals(object)

Creates a new DateTimeInterval initializing it with given days.

C#
public static DateTimeInterval FromDays(int days)
Parameters:daysint

The days, which will be used to initialize the DateTimeInterval.

Returns:

DateTimeInterval

A new DateTimeInterval.

Creates a new DateTimeInterval initializing it with given months.

C#
public static DateTimeInterval FromMonths(int months)
Parameters:monthsint

The months, which will be used to initialize the DateTimeInterval.

Returns:

DateTimeInterval

A new DateTimeInterval.

Gets the approximate total days count for the specified calendar. Uses Today's year for the calculate.

C#
public int GetApproximateTotalDays(Calendar calendar)
Parameters:calendarCalendar

The calendar object.

Returns:

int

Total days that this DateTimeInterval represents for the given calendar.

Returns the hash code for this instance.

C#
public override int GetHashCode()
Returns:

int

A 32-bit signed integer that is the hash code for this instance.

Overrides: ValueType.GetHashCode()

Constructs a new DateTimeInterval object from a string. The string should be in format like this: 12d 12m.

C#
public static DateTimeInterval Parse(string value)
Parameters:valuestring

A string that specifies the interval.

Returns:

DateTimeInterval

A DateTimeInterval that corresponds to value.

Exceptions:

ArgumentNullException

value is null.

ArgumentOutOfRangeException

value contains negative value.

FormatException

value is not in the correct format. The string should be in format like this: "{i}d {i}m" where {i} represents an int number.

OverflowException

Given values for Days or Months in value are less than 0 and MaxValue.

Constructs a new DateTimeInterval object from a string. The string should be in format like this: 12d 12m.

C#
public static bool TryParse(string value, out DateTimeInterval interval)
Parameters:valuestring

A string that specifies the interval.

intervalDateTimeInterval

The DateTimeInterval that will be created if the parsing is successful. If it failed the value will be Zero. This parameter is passed uninitialized.

Returns:

bool

True if value was converted successfully; otherwise false. This operator returns false if value is null, has an invalid format, or the given values for Days or Months are less than 0 and MaxValue.

Operators

Implements the operator !=.

C#
public static bool operator !=(DateTimeInterval self, DateTimeInterval other)
Parameters:selfDateTimeInterval

The self.

otherDateTimeInterval

The other.

Returns:

bool

True if self did not equals other.

Implements the operator ==.

C#
public static bool operator ==(DateTimeInterval self, DateTimeInterval other)
Parameters:selfDateTimeInterval

The self.

otherDateTimeInterval

The other.

Returns:

bool

The result of the operator.