Show / Hide Table of Contents

Class DateTimeDecoratorExtensions

Extension methods for the DateTime struct tailored to adhere the decorator pattern.

Inheritance
Object
DateTimeDecoratorExtensions
Namespace: Cuemon
Assembly: Cuemon.Core.dll
Syntax
public static class DateTimeDecoratorExtensions

Methods

| Improve this Doc View Source

GetUnixEpoch(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).

| Improve this Doc View Source

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

Exceptions
Type Condition
ArgumentNullException

decorator cannot be null.

| Improve this Doc View Source

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

Exceptions
Type Condition
ArgumentNullException

decorator cannot be null.

| Improve this Doc View Source

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

Remarks

This implementation converts the enclosed DateTime of the decorator to an UTC representation ONLY if the Kind equals Local.

| Improve this Doc View Source

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

Exceptions
Type Condition
ArgumentNullException

decorator cannot be null.

See Also

IDecorator<T>
Decorator<T>
  • Improve this Doc
  • View Source
In This Article
Back to top Copyright 2008-2022 Geekle. All rights reserved. Code with passion and love; deploy with confidence. 👨‍💻️🔥❤️🚀😎
Generated by DocFX