Class DateTimeInterval
Represents date time duration in days and/or months.
Inheritance
Namespace: Telerik.Windows.Controls.ScheduleView
Assembly: Telerik.Windows.Controls.ScheduleView.dll
Syntax
public sealed class DateTimeInterval : ValueType, IEquatable<DateTimeInterval>
Constructors
DateTimeInterval(Int32, Int32)
Initializes a new instance of the DateTimeInterval struct.
Declaration
public DateTimeInterval(int days, int months)
Parameters
System.Int32
days
The days. |
System.Int32
months
The months. |
DateTimeInterval(Int32, Int32, Int32)
Initializes a new instance of the DateTimeInterval struct.
Declaration
public DateTimeInterval(int days, int months, int weeks)
Parameters
System.Int32
days
The days. |
System.Int32
months
The months. |
System.Int32
weeks
The weeks. |
DateTimeInterval(Int32, Int32, Int32, Int32)
Initializes a new instance of the DateTimeInterval struct.
Declaration
public DateTimeInterval(int hours, int days, int months, int weeks)
Parameters
System.Int32
hours
The hours. |
System.Int32
days
The days. |
System.Int32
months
The months. |
System.Int32
weeks
The weeks. |
DateTimeInterval(Int32, Int32, Int32, Int32, Int32)
Initializes a new instance of the DateTimeInterval struct.
Declaration
public DateTimeInterval(int minutes, int hours, int days, int months, int weeks)
Parameters
System.Int32
minutes
The minutes. |
System.Int32
hours
The hours. |
System.Int32
days
The days. |
System.Int32
months
The months. |
System.Int32
weeks
The weeks. |
Fields
Zero
Identifies DateTimeInterval of zero duration.
Declaration
public static readonly DateTimeInterval Zero
Field Value
DateTimeInterval
|
Properties
Days
Gets the days.
Declaration
public int Days { get; }
Property Value
System.Int32
The days. |
Hours
Gets the hours.
Declaration
public int Hours { get; }
Property Value
System.Int32
The hours. |
Minutes
Gets the minutes.
Declaration
public int Minutes { get; }
Property Value
System.Int32
The minutes. |
Months
Gets the months.
Declaration
public int Months { get; }
Property Value
System.Int32
The months. |
Methods
ConvertToTimeSpan(DateTimeInterval)
Converts the given DateTimeInterval to TimeSpan.
Declaration
public static TimeSpan ConvertToTimeSpan(DateTimeInterval interval)
Parameters
DateTimeInterval
interval
DateTimeInterval. |
Returns
System.TimeSpan
TimeSpan. |
Equals(Object)
Indicates whether this instance and a specified object are equal.
Declaration
public override bool Equals(object obj)
Parameters
System.Object
obj
Another object to compare to. |
Returns
System.Boolean
True if |
Equals(DateTimeInterval)
Indicates whether this instance and a specified DateTimeInterval are equal.
Declaration
public bool Equals(DateTimeInterval other)
Parameters
DateTimeInterval
other
Another DateTimeInterval to compare to. |
Returns
System.Boolean
True if |
FromDays(Int32)
Creates a new DateTimeInterval initializing it with given days
.
Declaration
public static DateTimeInterval FromDays(int days)
Parameters
System.Int32
days
The days, which will be used to initialize the DateTimeInterval. |
Returns
DateTimeInterval
A new DateTimeInterval. |
FromMonths(Int32)
Creates a new DateTimeInterval initializing it with given months
.
Declaration
public static DateTimeInterval FromMonths(int months)
Parameters
System.Int32
months
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 System.DateTime.Today's year for the calculate.
Declaration
public int GetApproximateTotalDays(Calendar calendar)
Parameters
System.Globalization.Calendar
calendar
The calendar object. |
Returns
System.Int32
Total days that this DateTimeInterval represents for the given |
GetHashCode()
Returns the hash code for this instance.
Declaration
public override int GetHashCode()
Returns
System.Int32
A 32-bit signed integer that is the hash code for this instance. |
Parse(String)
Constructs a new DateTimeInterval object from a string. The string should be in
format like this: 12d 12m
.
Declaration
public static DateTimeInterval Parse(string value)
Parameters
System.String
value
A string that specifies the interval. |
Returns
DateTimeInterval
A DateTimeInterval that corresponds to |
Exceptions
System.ArgumentNullException
|
System.ArgumentOutOfRangeException
|
System.FormatException
|
System.OverflowException
Given values for Days or Months in |
TryParse(String, out DateTimeInterval)
Constructs a new DateTimeInterval object from a string. The string should be in
format like this: 12d 12m
.
Declaration
public static bool TryParse(string value, out DateTimeInterval interval)
Parameters
System.String
value
A string that specifies the interval. |
DateTimeInterval
interval
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
System.Boolean
True if |
Operators
Equality(DateTimeInterval, DateTimeInterval)
Implements the operator ==.
Declaration
public static bool operator ==(DateTimeInterval self, DateTimeInterval other)
Parameters
DateTimeInterval
self
The self. |
DateTimeInterval
other
The other. |
Returns
System.Boolean
The result of the operator. |
Inequality(DateTimeInterval, DateTimeInterval)
Implements the operator !=.
Declaration
public static bool operator !=(DateTimeInterval self, DateTimeInterval other)
Parameters
DateTimeInterval
self
The self. |
DateTimeInterval
other
The other. |
Returns
System.Boolean
True if |