Class DateTimeDecoratorExtensions
Extension methods for the DateTime struct tailored to adhere the decorator pattern.
Namespace: Cuemon
Assembly: Cuemon.Core.dll
Syntax
public static class DateTimeDecoratorExtensions
Methods
| Improve this Doc View SourceGetUnixEpoch(IDecorator<DateTime>)
Gets a DateTime initialized to midnight, January 1st, 1970 in Coordinated Universal Time (UTC).
Declaration
public static DateTime GetUnixEpoch(this IDecorator<DateTime> _)
Parameters
Type | Name | Description |
---|---|---|
IDecorator<DateTime> | _ | The IDecorator<T> to extend. |
Returns
Type | Description |
---|---|
DateTime | A a DateTime initialized to midnight, January 1st, 1970 in Coordinated Universal Time (UTC). |
ToDefaultKind(IDecorator<DateTime>)
Converts the enclosed DateTime of the decorator
to a representation that is not specified as either local time or UTC.
Declaration
public static DateTime ToDefaultKind(this IDecorator<DateTime> decorator)
Parameters
Type | Name | Description |
---|---|---|
IDecorator<DateTime> | decorator | The IDecorator<T> to extend. |
Returns
Type | Description |
---|---|
DateTime | A new DateTime value initialized to Unspecified that has the same number of ticks as the enclosed DateTime of the |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ToLocalKind(IDecorator<DateTime>)
Converts the enclosed DateTime of the decorator
to a local time representation.
Declaration
public static DateTime ToLocalKind(this IDecorator<DateTime> decorator)
Parameters
Type | Name | Description |
---|---|---|
IDecorator<DateTime> | decorator | The IDecorator<T> to extend. |
Returns
Type | Description |
---|---|
DateTime | A new DateTime value initialized to Local that has the same number of ticks as the enclosed DateTime of the |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ToUnixEpochTime(IDecorator<DateTime>)
Converts the enclosed DateTime of the decorator
to an equivalent UNIX Epoch time representation.
Declaration
public static double ToUnixEpochTime(this IDecorator<DateTime> decorator)
Parameters
Type | Name | Description |
---|---|---|
IDecorator<DateTime> | decorator | The IDecorator<T> to extend. |
Returns
Type | Description |
---|---|
Double | A Double value that is equivalent to the enclosed DateTime of the |
Remarks
This implementation converts the enclosed DateTime of the decorator
to an UTC representation ONLY if the Kind equals Local.
ToUtcKind(IDecorator<DateTime>)
Converts the enclosed DateTime of the decorator
to a Coordinated Universal Time (UTC) representation.
Declaration
public static DateTime ToUtcKind(this IDecorator<DateTime> decorator)
Parameters
Type | Name | Description |
---|---|---|
IDecorator<DateTime> | decorator | The IDecorator<T> to extend. |
Returns
Type | Description |
---|---|
DateTime | A new DateTime value initialized to Utc that has the same number of ticks as the object represented by the enclosed DateTime of the |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|