Table of Contents

Class DateTimeDecoratorExtensions

Namespace
Cuemon
Assembly
Cuemon.Core.dll

Extension methods for the DateTime struct hidden behind the IDecorator<T> interface.

public static class DateTimeDecoratorExtensions
Inheritance
DateTimeDecoratorExtensions

Methods

GetUnixEpoch(IDecorator<DateTime>)

Gets a DateTime initialized to midnight, January 1st, 1970 in Coordinated Universal Time (UTC).

public static DateTime GetUnixEpoch(this IDecorator<DateTime> _)

Parameters

_ IDecorator<DateTime>

The IDecorator<T> to extend.

Returns

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.

public static DateTime ToDefaultKind(this IDecorator<DateTime> decorator)

Parameters

decorator IDecorator<DateTime>

The IDecorator<T> to extend.

Returns

DateTime

A new DateTime value initialized to Unspecified that has the same number of ticks as the enclosed DateTime of the decorator.

Exceptions

ArgumentNullException

decorator cannot be null.

ToLocalKind(IDecorator<DateTime>)

Converts the enclosed DateTime of the decorator to a local time representation.

public static DateTime ToLocalKind(this IDecorator<DateTime> decorator)

Parameters

decorator IDecorator<DateTime>

The IDecorator<T> to extend.

Returns

DateTime

A new DateTime value initialized to Local that has the same number of ticks as the enclosed DateTime of the decorator.

Exceptions

ArgumentNullException

decorator cannot be null.

ToUnixEpochTime(IDecorator<DateTime>)

Converts the enclosed DateTime of the decorator to an equivalent UNIX Epoch time representation.

public static double ToUnixEpochTime(this IDecorator<DateTime> decorator)

Parameters

decorator IDecorator<DateTime>

The IDecorator<T> to extend.

Returns

Double

A Double value that is equivalent to the enclosed DateTime of the decorator.

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.

public static DateTime ToUtcKind(this IDecorator<DateTime> decorator)

Parameters

decorator IDecorator<DateTime>

The IDecorator<T> to extend.

Returns

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 decorator.

Exceptions

ArgumentNullException

decorator cannot be null.

See Also