Show / Hide Table of Contents

    Class DateTimeExtensions

    This is an extensions implementation of the System.DateTime structure using methods already found in the Microsoft .NET Framework.

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

    Methods

    | Improve this Doc

    Ceiling(DateTime, Double, TimeUnit)

    Returns a System.DateTime value that is rounded towards positive infinity.

    Declaration
    public static DateTime Ceiling(this DateTime value, double interval, TimeUnit timeUnit)
    Parameters
    Type Name Description
    System.DateTime value

    A System.DateTime value to be rounded.

    System.Double interval

    The System.Double value that in combination with timeUnit specifies the rounding of value.

    TimeUnit timeUnit

    One of the enumeration values that specifies the time unit of interval.

    Returns
    Type Description
    System.DateTime

    A System.DateTime value that is rounded towards positive infinity.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    interval is 0.

    | Improve this Doc

    Ceiling(DateTime, TimeSpan)

    Returns a System.DateTime value that is rounded towards positive infinity.

    Declaration
    public static DateTime Ceiling(this DateTime value, TimeSpan interval)
    Parameters
    Type Name Description
    System.DateTime value

    A System.DateTime value to be rounded.

    System.TimeSpan interval

    The System.TimeSpan value that specifies the rounding of value.

    Returns
    Type Description
    System.DateTime

    A System.DateTime value that is rounded towards positive infinity.

    | Improve this Doc

    Floor(DateTime, Double, TimeUnit)

    Returns a System.DateTime value that is rounded towards negative infinity.

    Declaration
    public static DateTime Floor(this DateTime value, double interval, TimeUnit timeUnit)
    Parameters
    Type Name Description
    System.DateTime value

    A System.DateTime value to be rounded.

    System.Double interval

    The System.Double value that in combination with timeUnit specifies the rounding of value.

    TimeUnit timeUnit

    One of the enumeration values that specifies the time unit of interval.

    Returns
    Type Description
    System.DateTime

    A System.DateTime value that is rounded towards negative infinity.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    interval is 0.

    | Improve this Doc

    Floor(DateTime, TimeSpan)

    Returns a System.DateTime value that is rounded towards negative infinity.

    Declaration
    public static DateTime Floor(this DateTime value, TimeSpan interval)
    Parameters
    Type Name Description
    System.DateTime value

    A System.DateTime value to be rounded.

    System.TimeSpan interval

    The System.TimeSpan value that specifies the rounding of value.

    Returns
    Type Description
    System.DateTime

    A System.DateTime value that is rounded towards negative infinity.

    | Improve this Doc

    IsTimeOfDayAfternoon(DateTime)

    Determines whether the specified dt is within Afternoon.

    Declaration
    public static bool IsTimeOfDayAfternoon(this DateTime dt)
    Parameters
    Type Name Description
    System.DateTime dt

    The System.DateTime to compare.

    Returns
    Type Description
    System.Boolean

    true if dt is within Afternoon; otherwise false.

    | Improve this Doc

    IsTimeOfDayEvening(DateTime)

    Determines whether the specified dt is within Evening.

    Declaration
    public static bool IsTimeOfDayEvening(this DateTime dt)
    Parameters
    Type Name Description
    System.DateTime dt

    The System.DateTime to compare.

    Returns
    Type Description
    System.Boolean

    true if dt is within Evening; otherwise false.

    | Improve this Doc

    IsTimeOfDayForenoon(DateTime)

    Determines whether the specified dt is within Forenoon.

    Declaration
    public static bool IsTimeOfDayForenoon(this DateTime dt)
    Parameters
    Type Name Description
    System.DateTime dt

    The System.DateTime to compare.

    Returns
    Type Description
    System.Boolean

    true if dt is within Forenoon; otherwise false.

    | Improve this Doc

    IsTimeOfDayMorning(DateTime)

    Determines whether the specified dt is within Morning.

    Declaration
    public static bool IsTimeOfDayMorning(this DateTime dt)
    Parameters
    Type Name Description
    System.DateTime dt

    The System.DateTime to compare.

    Returns
    Type Description
    System.Boolean

    true if dt is within Morning; otherwise false.

    | Improve this Doc

    IsTimeOfDayNight(DateTime)

    Determines whether the specified dt is within Night.

    Declaration
    public static bool IsTimeOfDayNight(this DateTime dt)
    Parameters
    Type Name Description
    System.DateTime dt

    The System.DateTime to compare.

    Returns
    Type Description
    System.Boolean

    true if dt is within Night; otherwise false.

    | Improve this Doc

    IsWithinRange(DateTime, TimeRange)

    Determines whether the specified dt is within range.

    Declaration
    public static bool IsWithinRange(this DateTime dt, TimeRange range)
    Parameters
    Type Name Description
    System.DateTime dt

    The System.DateTime to compare.

    TimeRange range

    The TimeRange of dt.

    Returns
    Type Description
    System.Boolean

    true if dt is within the specified range; otherwise false.

    | Improve this Doc

    IsWithinRange(DateTime, DateTime, DateTime)

    Determines whether the specified dt is within range of min and max.

    Declaration
    public static bool IsWithinRange(this DateTime dt, DateTime min, DateTime max)
    Parameters
    Type Name Description
    System.DateTime dt

    The System.DateTime to compare.

    System.DateTime min

    The minimum value of dt.

    System.DateTime max

    The maximum value of dt.

    Returns
    Type Description
    System.Boolean

    true if dt is within the specified range of min and max; otherwise false.

    | Improve this Doc

    Round(DateTime, Double, TimeUnit, VerticalDirection)

    Returns a System.DateTime value that is rounded either towards negative infinity or positive infinity.

    Declaration
    public static DateTime Round(this DateTime value, double interval, TimeUnit timeUnit, VerticalDirection direction)
    Parameters
    Type Name Description
    System.DateTime value

    A System.DateTime value to be rounded.

    System.Double interval

    The System.Double value that in combination with timeUnit specifies the rounding of value.

    TimeUnit timeUnit

    One of the enumeration values that specifies the time unit of interval.

    VerticalDirection direction

    One of the enumeration values that specifies the direction of the rounding.

    Returns
    Type Description
    System.DateTime

    A System.DateTime value that is rounded either towards negative infinity or positive infinity.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    direction is an invalid enumeration value.

    System.ArgumentOutOfRangeException

    interval is System.TimeSpan.Zero.

    | Improve this Doc

    Round(DateTime, TimeSpan, VerticalDirection)

    Returns a System.DateTime value that is rounded either towards negative infinity or positive infinity.

    Declaration
    public static DateTime Round(this DateTime value, TimeSpan interval, VerticalDirection direction)
    Parameters
    Type Name Description
    System.DateTime value

    A System.DateTime value to be rounded.

    System.TimeSpan interval

    The System.TimeSpan value that specifies the rounding of value.

    VerticalDirection direction

    One of the enumeration values that specifies the direction of the rounding.

    Returns
    Type Description
    System.DateTime

    A System.DateTime value that is rounded either towards negative infinity or positive infinity.

    Exceptions
    Type Condition
    System.ArgumentOutOfRangeException

    direction is an invalid enumeration value.

    System.ArgumentOutOfRangeException

    interval is System.TimeSpan.Zero.

    | Improve this Doc

    ToDefaultKind(DateTime)

    Converts the specified value to a representation that is not specified as either local time or UTC.

    Declaration
    public static DateTime ToDefaultKind(this DateTime value)
    Parameters
    Type Name Description
    System.DateTime value

    The value to convert.

    Returns
    Type Description
    System.DateTime

    A new System.DateTime value initialized to System.DateTimeKind.Unspecified that has the same number of ticks as the object represented by the value parameter.

    | Improve this Doc

    ToLocalKind(DateTime)

    Converts the specified value to a local time representation.

    Declaration
    public static DateTime ToLocalKind(this DateTime value)
    Parameters
    Type Name Description
    System.DateTime value

    The value to convert.

    Returns
    Type Description
    System.DateTime

    A new System.DateTime value initialized to System.DateTimeKind.Local that has the same number of ticks as the object represented by the value parameter.

    | Improve this Doc

    ToUtcKind(DateTime)

    Converts the specified value to a Coordinated Universal Time (UTC) representation.

    Declaration
    public static DateTime ToUtcKind(this DateTime value)
    Parameters
    Type Name Description
    System.DateTime value

    The value to convert.

    Returns
    Type Description
    System.DateTime

    A new System.DateTime value initialized to System.DateTimeKind.Utc that has the same number of ticks as the object represented by the value parameter.

    • Improve this Doc
    • View Source
    Back to top Copyright 2008-2018 Weubphoria. All rights reserved.
    Generated by DocFX