JK
Search Results for

    Show / Hide Table of Contents

    Class DateTimeExtensions

    Extension methods for the DateTime object.

    Inheritance
    System.Object
    DateTimeExtensions
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: JK.Common.Extensions
    Assembly: JK.Common.dll
    Syntax
    public static class DateTimeExtensions

    Methods

    | Improve this Doc View Source

    AddWorkDays(DateTime, in Int32)

    Adds given number of business days to a date.

    Declaration
    public static DateTime AddWorkDays(this DateTime dt, in int days)
    Parameters
    Type Name Description
    System.DateTime dt

    Current DateTime object from extension method.

    System.Int32 days

    Number of days to add (can be negative).

    Returns
    Type Description
    System.DateTime

    The date the given amount of business days from the start date.

    | Improve this Doc View Source

    CalculateAge(DateTime, in DateTime)

    Calculates age of an individual.

    Declaration
    public static int CalculateAge(this DateTime dt, in DateTime birthday)
    Parameters
    Type Name Description
    System.DateTime dt

    Current DateTime object from extension method.

    System.DateTime birthday

    Date of birth.

    Returns
    Type Description
    System.Int32

    Age from birth date to given date.

    | Improve this Doc View Source

    GetAbbreviatedDayName(DateTime)

    Gets the abbreviated day name.

    Declaration
    public static string GetAbbreviatedDayName(this DateTime dt)
    Parameters
    Type Name Description
    System.DateTime dt

    Current DateTime object from extension method.

    Returns
    Type Description
    System.String

    Abbreviated day name.

    | Improve this Doc View Source

    GetAbbreviatedMonthName(DateTime)

    Gets the abbreviated month name.

    Declaration
    public static string GetAbbreviatedMonthName(this DateTime dt)
    Parameters
    Type Name Description
    System.DateTime dt

    Current DateTime object from extension method.

    Returns
    Type Description
    System.String

    Abbreviated month name.

    | Improve this Doc View Source

    GetDayName(DateTime)

    Gets the full name of a given day.

    Declaration
    public static string GetDayName(this DateTime dt)
    Parameters
    Type Name Description
    System.DateTime dt

    Current DateTime object from extension method.

    Returns
    Type Description
    System.String

    Full day name.

    | Improve this Doc View Source

    GetMonthName(DateTime)

    Gets the full name of a month.

    Declaration
    public static string GetMonthName(this DateTime dt)
    Parameters
    Type Name Description
    System.DateTime dt

    Current DateTime object from extension method.

    Returns
    Type Description
    System.String

    Full month name.

    | Improve this Doc View Source

    IsBetween(DateTime, in DateTime, in DateTime)

    Determines whether or not a given date is between (inclusive) the given start and end dates.

    Declaration
    public static bool IsBetween(this DateTime dt, in DateTime start, in DateTime end)
    Parameters
    Type Name Description
    System.DateTime dt

    Current DateTime object from extension method.

    System.DateTime start

    Start of date range to check

    System.DateTime end

    End of date range to check

    Returns
    Type Description
    System.Boolean

    True if date falls within range, otherwise false

    | Improve this Doc View Source

    IsWeekday(DateTime)

    Determines if given date is a weekday.

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

    Current DateTime object from extension method.

    Returns
    Type Description
    System.Boolean

    True if is a weekday, otherwise false.

    | Improve this Doc View Source

    IsWeekend(DateTime)

    Determines if given date is a weekday.

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

    Current DateTime object from extension method.

    Returns
    Type Description
    System.Boolean

    True if is a weekend, otherwise false.

    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © Jeremy Knight. Generated with DocFX