Struct DateSpan
Implements
Namespace: Cuemon
Assembly: Cuemon.Core.dll
Syntax
public readonly struct DateSpan : IEquatable<DateSpan>
Constructors
| Improve this Doc View SourceDateSpan(DateTime)
Declaration
public DateSpan(DateTime start)
Parameters
Type | Name | Description |
---|---|---|
DateTime | start |
DateSpan(DateTime, DateTime)
Initializes a new instance of the DateSpan structure with a default Cuemon.DateSpan._calendar value from the InvariantCulture class.
Declaration
public DateSpan(DateTime start, DateTime end)
Parameters
Type | Name | Description |
---|---|---|
DateTime | start | |
DateTime | end |
DateSpan(DateTime, DateTime, Calendar)
Initializes a new instance of the DateSpan structure.
Declaration
public DateSpan(DateTime start, DateTime end, Calendar calendar)
Parameters
Type | Name | Description |
---|---|---|
DateTime | start | |
DateTime | end | |
Calendar | calendar |
Properties
| Improve this Doc View SourceDays
Gets the number of days represented by the current DateSpan structure.
Declaration
public readonly int Days { get; }
Property Value
Type | Description |
---|---|
Int32 | The number of days represented by the current DateSpan structure. |
Hours
Gets the number of hours represented by the current DateSpan structure.
Declaration
public readonly int Hours { get; }
Property Value
Type | Description |
---|---|
Int32 | The number of hours represented by the current DateSpan structure. |
Milliseconds
Gets the number of milliseconds represented by the current DateSpan structure.
Declaration
public readonly int Milliseconds { get; }
Property Value
Type | Description |
---|---|
Int32 | The number of milliseconds represented by the current DateSpan structure. |
Minutes
Gets the number of minutes represented by the current DateSpan structure.
Declaration
public readonly int Minutes { get; }
Property Value
Type | Description |
---|---|
Int32 | The number of minutes represented by the current DateSpan structure. |
Months
Gets the number of months represented by the current DateSpan structure.
Declaration
public readonly int Months { get; }
Property Value
Type | Description |
---|---|
Int32 | The number of months represented by the current DateSpan structure. |
Seconds
Gets the number of seconds represented by the current DateSpan structure.
Declaration
public readonly int Seconds { get; }
Property Value
Type | Description |
---|---|
Int32 | The number of seconds represented by the current DateSpan structure. |
Ticks
Gets the number of ticks represented by the current DateSpan structure.
Declaration
public readonly long Ticks { get; }
Property Value
Type | Description |
---|---|
Int64 | The number of ticks represented by the current DateSpan structure. |
TotalDays
Gets the total number of days represented by the current DateSpan structure.
Declaration
public readonly double TotalDays { get; }
Property Value
Type | Description |
---|---|
Double | The total number of days represented by the current DateSpan structure. |
TotalHours
Gets the total number of hours represented by the current DateSpan structure.
Declaration
public readonly double TotalHours { get; }
Property Value
Type | Description |
---|---|
Double | The total number of hours represented by the current DateSpan structure. |
TotalMilliseconds
Gets the total number of milliseconds represented by the current DateSpan structure.
Declaration
public readonly double TotalMilliseconds { get; }
Property Value
Type | Description |
---|---|
Double | The total number of milliseconds represented by the current DateSpan structure. |
TotalMinutes
Gets the total number of minutes represented by the current DateSpan structure.
Declaration
public readonly double TotalMinutes { get; }
Property Value
Type | Description |
---|---|
Double | The total number of minutes represented by the current DateSpan structure. |
TotalMonths
Gets the total number of months represented by the current DateSpan structure.
Declaration
public readonly double TotalMonths { get; }
Property Value
Type | Description |
---|---|
Double | The total number of months represented by the current DateSpan structure. |
TotalSeconds
Gets the total number of seconds represented by the current DateSpan structure.
Declaration
public readonly double TotalSeconds { get; }
Property Value
Type | Description |
---|---|
Double | The total number of seconds represented by the current DateSpan structure. |
TotalYears
Gets the total number of years represented by the current DateSpan structure.
Declaration
public readonly double TotalYears { get; }
Property Value
Type | Description |
---|---|
Double | The total number of years represented by the current DateSpan structure. |
Years
Gets the number of years represented by the current DateSpan structure.
Declaration
public readonly int Years { get; }
Property Value
Type | Description |
---|---|
Int32 | The number of years represented by the current DateSpan structure. |
Methods
| Improve this Doc View SourceEquals(DateSpan)
Indicates whether the current object is equal to another object of the same type.
Declaration
public readonly bool Equals(DateSpan other)
Parameters
Type | Name | Description |
---|---|---|
DateSpan | other | An object to compare with this object. |
Returns
Type | Description |
---|---|
Boolean |
|
Equals(Object)
Determines whether the specified Object is equal to this instance.
Declaration
public override readonly bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The Object to compare with this instance. |
Returns
Type | Description |
---|---|
Boolean |
|
Overrides
| Improve this Doc View SourceGetHashCode()
Returns a hash code for this instance.
Declaration
public override readonly int GetHashCode()
Returns
Type | Description |
---|---|
Int32 | A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |
Overrides
| Improve this Doc View SourceGetWeeks()
Calculates the number of weeks represented by the current DateSpan structure.
Declaration
public readonly int GetWeeks()
Returns
Type | Description |
---|---|
Int32 | Calculates the number of weeks represented by the current DateSpan structure. |
Parse(String)
Constructs a new DateSpan object from a date and time interval specified in a string.
Declaration
public static DateSpan Parse(string start)
Parameters
Type | Name | Description |
---|---|---|
String | start | A string that specifies the starting date and time value for the DateSpan interval. |
Returns
Type | Description |
---|---|
DateSpan | A DateSpan that corresponds to |
Parse(String, String)
Constructs a new DateSpan object from a date and time interval specified in a string.
Declaration
public static DateSpan Parse(string start, string end)
Parameters
Type | Name | Description |
---|---|---|
String | start | A string that specifies the starting date and time value for the DateSpan interval. |
String | end | A string that specifies the ending date and time value for the DateSpan interval. |
Returns
Type | Description |
---|---|
DateSpan | A DateSpan that corresponds to |
Parse(String, String, CultureInfo)
Constructs a new DateSpan object from a date and time interval specified in a string.
Declaration
public static DateSpan Parse(string start, string end, CultureInfo culture)
Parameters
Type | Name | Description |
---|---|---|
String | start | A string that specifies the starting date and time value for the DateSpan interval. |
String | end | A string that specifies the ending date and time value for the DateSpan interval. |
CultureInfo | culture | A CultureInfo to resolve a Cuemon.DateSpan._calendar object from. |
Returns
Type | Description |
---|---|
DateSpan | A DateSpan that corresponds to |
ToString()
Converts the value of the current DateSpan object to its equivalent string representation.
Declaration
public override readonly string ToString()
Returns
Type | Description |
---|---|
String |
Overrides
Remarks
The returned string has the following format: y*:MM:dd:hh:mm:ss.f*, where y* is the actual calculated years and f* is the actual calculated milliseconds.
Operators
| Improve this Doc View SourceEquality(DateSpan, DateSpan)
Indicates whether two DateSpan instances are equal.
Declaration
public static bool operator ==(DateSpan dateSpan1, DateSpan dateSpan2)
Parameters
Type | Name | Description |
---|---|---|
DateSpan | dateSpan1 | The first date interval to compare. |
DateSpan | dateSpan2 | The second date interval to compare. |
Returns
Type | Description |
---|---|
Boolean |
|
Inequality(DateSpan, DateSpan)
Indicates whether two DateSpan instances are not equal.
Declaration
public static bool operator !=(DateSpan dateSpan1, DateSpan dateSpan2)
Parameters
Type | Name | Description |
---|---|---|
DateSpan | dateSpan1 | The first date interval to compare. |
DateSpan | dateSpan2 | The second date interval to compare. |
Returns
Type | Description |
---|---|
Boolean |
|