Struct
DateTimeInterval

Represents date time duration in days and/or months.

Definition

Namespace:Telerik.Windows.Controls.ScheduleView

Assembly:Telerik.Windows.Controls.ScheduleView.dll

Syntax:

cs-api-definition
[TypeConverter(typeof(DateTimeIntervalConverter))]
public struct DateTimeInterval : IEquatable<DateTimeInterval>

Implements: IEquatable<DateTimeInterval>

Inherited Members ValueType.ToString()

Constructors

DateTimeInterval(int, int)

Initializes a new instance of the DateTimeInterval struct.

Declaration

cs-api-definition
public DateTimeInterval(int days, int months)

Parameters

days

int

The days.

months

int

The months.

DateTimeInterval(int, int, int)

Initializes a new instance of the DateTimeInterval struct.

Declaration

cs-api-definition
public DateTimeInterval(int days, int months, int weeks)

Parameters

days

int

The days.

months

int

The months.

weeks

int

The weeks.

DateTimeInterval(int, int, int, int)

Initializes a new instance of the DateTimeInterval struct.

Declaration

cs-api-definition
public DateTimeInterval(int hours, int days, int months, int weeks)

Parameters

hours

int

The hours.

days

int

The days.

months

int

The months.

weeks

int

The weeks.

DateTimeInterval(int, int, int, int, int)

Initializes a new instance of the DateTimeInterval struct.

Declaration

cs-api-definition
public DateTimeInterval(int minutes, int hours, int days, int months, int weeks)

Parameters

minutes

int

The minutes.

hours

int

The hours.

days

int

The days.

months

int

The months.

weeks

int

The weeks.

Fields

Zero

Identifies DateTimeInterval of zero duration.

Declaration

cs-api-definition
public static readonly DateTimeInterval Zero

Field Value

DateTimeInterval

Properties

Days

Gets the days.

Declaration

cs-api-definition
public int Days { get; }

Property Value

int

The days.

Hours

Gets the hours.

Declaration

cs-api-definition
public int Hours { get; }

Property Value

int

The hours.

Minutes

Gets the minutes.

Declaration

cs-api-definition
public int Minutes { get; }

Property Value

int

The minutes.

Months

Gets the months.

Declaration

cs-api-definition
public int Months { get; }

Property Value

int

The months.

Methods

ConvertToTimeSpan(DateTimeInterval)

Converts the given DateTimeInterval to TimeSpan.

Declaration

cs-api-definition
public static TimeSpan ConvertToTimeSpan(DateTimeInterval interval)

Parameters

interval

DateTimeInterval

DateTimeInterval.

Returns

TimeSpan

TimeSpan.

Equals(DateTimeInterval)

Indicates whether this instance and a specified DateTimeInterval are equal.

Declaration

cs-api-definition
public bool Equals(DateTimeInterval other)

Parameters

other

DateTimeInterval

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)

Equals(object)

Indicates whether this instance and a specified object are equal.

Declaration

cs-api-definition
public override bool Equals(object obj)

Parameters

obj

object

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)

FromDays(int)

Creates a new DateTimeInterval initializing it with given days.

Declaration

cs-api-definition
public static DateTimeInterval FromDays(int days)

Parameters

days

int

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

Returns

DateTimeInterval

A new DateTimeInterval.

FromMonths(int)

Creates a new DateTimeInterval initializing it with given months.

Declaration

cs-api-definition
public static DateTimeInterval FromMonths(int months)

Parameters

months

int

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

Returns

DateTimeInterval

A new DateTimeInterval.

GetApproximateTotalDays(Calendar)

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

Declaration

cs-api-definition
public int GetApproximateTotalDays(Calendar calendar)

Parameters

calendar

Calendar

The calendar object.

Returns

int

Total days that this DateTimeInterval represents for the given calendar.

GetHashCode()

Returns the hash code for this instance.

Declaration

cs-api-definition
public override int GetHashCode()

Returns

int

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

Overrides ValueType.GetHashCode()

Parse(string)

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

Declaration

cs-api-definition
public static DateTimeInterval Parse(string value)

Parameters

value

string

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.

TryParse(string, out DateTimeInterval)

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

Declaration

cs-api-definition
public static bool TryParse(string value, out DateTimeInterval interval)

Parameters

value

string

A string that specifies the interval.

interval

DateTimeInterval

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

operator !=(DateTimeInterval, DateTimeInterval)

Implements the operator !=.

Declaration

cs-api-definition
public static bool operator !=(DateTimeInterval self, DateTimeInterval other)

Parameters

self

DateTimeInterval

The self.

other

DateTimeInterval

The other.

Returns

bool

True if self did not equals other.

operator ==(DateTimeInterval, DateTimeInterval)

Implements the operator ==.

Declaration

cs-api-definition
public static bool operator ==(DateTimeInterval self, DateTimeInterval other)

Parameters

self

DateTimeInterval

The self.

other

DateTimeInterval

The other.

Returns

bool

The result of the operator.