C# Класс Utilities.Extensions.DateExtensions

Показать файл Открыть проект

Открытые методы

Метод Описание
Diff ( this dateOne, System.DateTime dateTwo ) : System.TimeSpan

Diffs the specified date.

DiffDays ( this dateOne, System.DateTime dateTwo ) : double

Returns a double indicating the number of days between two dates (past is negative)

DiffDays ( this dateOne, string dateTwo ) : double

Returns a double indicating the number of days between two dates (past is negative)

DiffHours ( this dateOne, System.DateTime dateTwo ) : double

Returns a double indicating the number of days between two dates (past is negative)

DiffHours ( this dateOne, string dateTwo ) : double

Returns a double indicating the number of days between two dates (past is negative)

DiffMinutes ( this dateOne, System.DateTime dateTwo ) : double

Returns a double indicating the number of days between two dates (past is negative)

DiffMinutes ( this dateOne, string dateTwo ) : double

Returns a double indicating the number of days between two dates (past is negative)

GetDateDayWithSuffix ( this date ) : string

Given a datetime object, returns the formatted day, "15th"

GetFormattedMonthAndDay ( this date ) : string

Given a datetime object, returns the formatted month and day, i.e. "April 15th"

IsLastDayOfMonth ( this date ) : bool

Determines whether [is last day of month] [the specified date].

IsLeapYear ( this date ) : bool

Determines whether [is leap year] [the specified date].

IsWeekDay ( this dt ) : bool

Checks to see if the date is a week day (Mon - Fri)

IsWeekend ( this source ) : bool

Determines whether the specified date is a weekend.

LastDayOfMonth ( this date ) : int

Gets the Last the day of month.

SetDay ( this source, int day ) : System.DateTime

Returns a new instance of DateTime with a different day of the month.

SetMonth ( this source, int month ) : System.DateTime

Returns a new instance of DateTime with a different month.

SetYear ( this source, int year ) : System.DateTime

Returns a new instance of DateTime with a different year.

ToMigrationString ( this dt ) : string

Returns a datetime formatted as a string in yyyyMMddhhmm

Описание методов

Diff() публичный статический Метод

Diffs the specified date.
public static Diff ( this dateOne, System.DateTime dateTwo ) : System.TimeSpan
dateOne this The date one.
dateTwo System.DateTime The date two.
Результат System.TimeSpan

DiffDays() публичный статический Метод

Returns a double indicating the number of days between two dates (past is negative)
public static DiffDays ( this dateOne, System.DateTime dateTwo ) : double
dateOne this The date one.
dateTwo System.DateTime The date two.
Результат double

DiffDays() публичный статический Метод

Returns a double indicating the number of days between two dates (past is negative)
public static DiffDays ( this dateOne, string dateTwo ) : double
dateOne this The date one.
dateTwo string The date two.
Результат double

DiffHours() публичный статический Метод

Returns a double indicating the number of days between two dates (past is negative)
public static DiffHours ( this dateOne, System.DateTime dateTwo ) : double
dateOne this The date one.
dateTwo System.DateTime The date two.
Результат double

DiffHours() публичный статический Метод

Returns a double indicating the number of days between two dates (past is negative)
public static DiffHours ( this dateOne, string dateTwo ) : double
dateOne this The date one.
dateTwo string The date two.
Результат double

DiffMinutes() публичный статический Метод

Returns a double indicating the number of days between two dates (past is negative)
public static DiffMinutes ( this dateOne, System.DateTime dateTwo ) : double
dateOne this The date one.
dateTwo System.DateTime The date two.
Результат double

DiffMinutes() публичный статический Метод

Returns a double indicating the number of days between two dates (past is negative)
public static DiffMinutes ( this dateOne, string dateTwo ) : double
dateOne this The date one.
dateTwo string The date two.
Результат double

GetDateDayWithSuffix() публичный статический Метод

Given a datetime object, returns the formatted day, "15th"
public static GetDateDayWithSuffix ( this date ) : string
date this The date to extract the string from
Результат string

GetFormattedMonthAndDay() публичный статический Метод

Given a datetime object, returns the formatted month and day, i.e. "April 15th"
public static GetFormattedMonthAndDay ( this date ) : string
date this The date to extract the string from
Результат string

IsLastDayOfMonth() публичный статический Метод

Determines whether [is last day of month] [the specified date].
public static IsLastDayOfMonth ( this date ) : bool
date this The date.
Результат bool

IsLeapYear() публичный статический Метод

Determines whether [is leap year] [the specified date].
public static IsLeapYear ( this date ) : bool
date this The date.
Результат bool

IsWeekDay() публичный статический Метод

Checks to see if the date is a week day (Mon - Fri)
public static IsWeekDay ( this dt ) : bool
dt this The dt.
Результат bool

IsWeekend() публичный статический Метод

Determines whether the specified date is a weekend.
public static IsWeekend ( this source ) : bool
source this Source date
Результат bool

LastDayOfMonth() публичный статический Метод

Gets the Last the day of month.
public static LastDayOfMonth ( this date ) : int
date this The date.
Результат int

SetDay() публичный статический Метод

Returns a new instance of DateTime with a different day of the month.
public static SetDay ( this source, int day ) : System.DateTime
source this Base DateTime object to modify
day int Day of the month (1-31)
Результат System.DateTime

SetMonth() публичный статический Метод

Returns a new instance of DateTime with a different month.
public static SetMonth ( this source, int month ) : System.DateTime
source this Base DateTime object to modify
month int The month as an integer (1-12)
Результат System.DateTime

SetYear() публичный статический Метод

Returns a new instance of DateTime with a different year.
public static SetYear ( this source, int year ) : System.DateTime
source this Base DateTime object to modify
year int The year
Результат System.DateTime

ToMigrationString() публичный статический Метод

Returns a datetime formatted as a string in yyyyMMddhhmm
public static ToMigrationString ( this dt ) : string
dt this The datetime to convert
Результат string