C# Класс Aqueduct.Extensions.Dates

Summary for the Dates class
Показать файл Открыть проект

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

Метод Описание
CountWeekdays ( this startTime, System.DateTime endTime ) : int

Counts the number of weekdays between two dates.

CountWeekends ( this startTime, System.DateTime endTime ) : int

Counts the number of weekends between two dates.

DaysAgo ( this days ) : System.DateTime

Returns a date in the past by days.

DaysFromNow ( this days ) : System.DateTime

Returns a date in the future by days.

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"

HoursAgo ( this hours ) : System.DateTime

Returns a date in the past by hours.

HoursFromNow ( this hours ) : System.DateTime

Returns a date in the future by hours.

IsDate ( this dt ) : bool

Verifies if the object is a date

IsWeekDay ( this dt ) : bool

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

IsWeekEnd ( this dt ) : bool

Checks to see if the date is Saturday or Sunday

MinutesAgo ( this minutes ) : System.DateTime

Returns a date in the past by minutes

MinutesFromNow ( this minutes ) : System.DateTime

Returns a date in the future by minutes.

ReadableDiff ( this startTime, System.DateTime endTime ) : string

Displays the difference in time between the two dates. Return example is "12 years 4 months 24 days 8 hours 33 minutes 5 seconds"

SecondsAgo ( this seconds ) : System.DateTime

Gets a date in the past according to seconds

SecondsFromNow ( this seconds ) : System.DateTime

Gets a date in the future by seconds.

TimeDiff ( this startTime, System.DateTime endTime ) : string

Displays the difference in time between the two dates. Return example is "12 years 4 months 24 days 8 hours 33 minutes 5 seconds"

Приватные методы

Метод Описание
FormatString ( this str, string previousStr, int t ) : string

Remove leading strings with zeros and adjust for singular/plural

GetSuffix ( int dayNumber ) : string

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

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

Counts the number of weekdays between two dates.
public static CountWeekdays ( this startTime, System.DateTime endTime ) : int
startTime this The start time.
endTime System.DateTime The end time.
Результат int

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

Counts the number of weekends between two dates.
public static CountWeekends ( this startTime, System.DateTime endTime ) : int
startTime this The start time.
endTime System.DateTime The end time.
Результат int

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

Returns a date in the past by days.
public static DaysAgo ( this days ) : System.DateTime
days this The days.
Результат System.DateTime

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

Returns a date in the future by days.
public static DaysFromNow ( this days ) : System.DateTime
days this The days.
Результат System.DateTime

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

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

Returns a date in the past by hours.
public static HoursAgo ( this hours ) : System.DateTime
hours this The hours.
Результат System.DateTime

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

Returns a date in the future by hours.
public static HoursFromNow ( this hours ) : System.DateTime
hours this The hours.
Результат System.DateTime

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

Verifies if the object is a date
public static IsDate ( this dt ) : bool
dt this The dt.
Результат 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() публичный статический Метод

Checks to see if the date is Saturday or Sunday
public static IsWeekEnd ( this dt ) : bool
dt this The dt.
Результат bool

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

Returns a date in the past by minutes
public static MinutesAgo ( this minutes ) : System.DateTime
minutes this The minutes.
Результат System.DateTime

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

Returns a date in the future by minutes.
public static MinutesFromNow ( this minutes ) : System.DateTime
minutes this The minutes.
Результат System.DateTime

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

Displays the difference in time between the two dates. Return example is "12 years 4 months 24 days 8 hours 33 minutes 5 seconds"
public static ReadableDiff ( this startTime, System.DateTime endTime ) : string
startTime this The start time.
endTime System.DateTime The end time.
Результат string

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

Gets a date in the past according to seconds
public static SecondsAgo ( this seconds ) : System.DateTime
seconds this The seconds.
Результат System.DateTime

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

Gets a date in the future by seconds.
public static SecondsFromNow ( this seconds ) : System.DateTime
seconds this The seconds.
Результат System.DateTime

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

Displays the difference in time between the two dates. Return example is "12 years 4 months 24 days 8 hours 33 minutes 5 seconds"
public static TimeDiff ( this startTime, System.DateTime endTime ) : string
startTime this The start time.
endTime System.DateTime The end time.
Результат string