C# Класс Aspectacular.DateTimeExtensions

Contains utility & convenience DateTime methods
Показать файл Открыть проект

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

Метод Описание
FromSortableIntDateTime ( this sortableDateTime, DateTimeKind dtKind = DateTimeKind.Unspecified ) : System.DateTime

Returns DateTime created from an integer in the YYYYMMDD, YYYYMMDDHHmmss, or YYYYMMDDHHmmssFFF format.

FromSortableIntDateTime ( this sortableDateTime, DateTimeKind dtKind = DateTimeKind.Unspecified ) : DateTime?

Returns DateTime created from an integer in the YYYYMMDD, YYYYMMDDHHmmss, or YYYYMMDDHHmmssFFF format.

FromSortableIntTime ( this sortableDateTime, System.DateTime datePart = default(DateTime) ) : System.DateTime

Returns time value via DateTime result created from integer in the HHmmss or HHmmssFFF format. Optional "FFF" is milliseconds.

FromSortableIntTime ( this sortableDateTime, System.DateTime datePart = default(DateTime) ) : DateTime?

Returns time value via DateTime result created from integer in the HHmmss or HHmmssFFF format. Optional "FFF" is milliseconds.

GoTo ( this dt, bool>.Func stopCondFunc, DateTime>.Func stepFunc ) : System.DateTime

DateTime loop functional implementation. Continues calling stepFunc while searchFunc keeps returning true: while (!searchFunc(dt)) dt = stepFunc(dt); return dt;

GoTo ( this dt, bool>.Func stopCondFunc, DateTimeOffset>.Func stepFunc ) : DateTimeOffset

DateTimeOffset loop functional implementation. Continues calling stepFunc while searchFunc keeps returning true: while (!searchFunc(dt)) dt = stepFunc(dt); return dt;

IsUtc ( this dto ) : bool

Returns true if DateTimeOffset represents UTC time.

PreviousMoment ( this dt ) : System.DateTime

Subtracts 1 tick from the given time.

PreviousMoment ( this dt ) : DateTimeOffset

Subtracts 1 tick from the given time.

Quarter ( this dt ) : int

Returns quarter number 1..4

ToDateTime ( this dto, DateTimeKind kind ) : System.DateTime
ToSortableIntDate ( this dt ) : int

Converts date part of the date time to integer in the YYYYMMDD format.

ToSortableIntTime ( this dt, bool includeMilliseconds = false ) : int

Returns integer in the format of HHmmss or HHmmssFFF. Optional "FFF" is milliseconds.

ToSortableLongDateTime ( this dt, bool includeMilliseconds = false ) : long

Returns integer in the format of YYYYMMDDHHmmss or similar with fractional seconds.

ToSortableLongTime ( this dt, bool includeMilliseconds = false ) : long

Returns integer in the format of HHmmss or HHmmssFFF. Optional "FFF" is milliseconds.

WeekOfYear ( this dt, CalendarWeekRule whatIsFirstWeek = CalendarWeekRule.FirstFourDayWeek ) : int

Returns ISO-8601 week number in the year.

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

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

Returns DateTime created from an integer in the YYYYMMDD, YYYYMMDDHHmmss, or YYYYMMDDHHmmssFFF format.
public static FromSortableIntDateTime ( this sortableDateTime, DateTimeKind dtKind = DateTimeKind.Unspecified ) : System.DateTime
sortableDateTime this
dtKind DateTimeKind
Результат System.DateTime

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

Returns DateTime created from an integer in the YYYYMMDD, YYYYMMDDHHmmss, or YYYYMMDDHHmmssFFF format.
public static FromSortableIntDateTime ( this sortableDateTime, DateTimeKind dtKind = DateTimeKind.Unspecified ) : DateTime?
sortableDateTime this
dtKind DateTimeKind
Результат DateTime?

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

Returns time value via DateTime result created from integer in the HHmmss or HHmmssFFF format. Optional "FFF" is milliseconds.
public static FromSortableIntTime ( this sortableDateTime, System.DateTime datePart = default(DateTime) ) : System.DateTime
sortableDateTime this
datePart System.DateTime Date to which time will be appended.
Результат System.DateTime

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

Returns time value via DateTime result created from integer in the HHmmss or HHmmssFFF format. Optional "FFF" is milliseconds.
public static FromSortableIntTime ( this sortableDateTime, System.DateTime datePart = default(DateTime) ) : DateTime?
sortableDateTime this
datePart System.DateTime Date to which time will be appended.
Результат DateTime?

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

DateTime loop functional implementation. Continues calling stepFunc while searchFunc keeps returning true: while (!searchFunc(dt)) dt = stepFunc(dt); return dt;
public static GoTo ( this dt, bool>.Func stopCondFunc, DateTime>.Func stepFunc ) : System.DateTime
dt this
stopCondFunc bool>.Func
stepFunc DateTime>.Func
Результат System.DateTime

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

DateTimeOffset loop functional implementation. Continues calling stepFunc while searchFunc keeps returning true: while (!searchFunc(dt)) dt = stepFunc(dt); return dt;
public static GoTo ( this dt, bool>.Func stopCondFunc, DateTimeOffset>.Func stepFunc ) : DateTimeOffset
dt this
stopCondFunc bool>.Func
stepFunc DateTimeOffset>.Func
Результат DateTimeOffset

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

Returns true if DateTimeOffset represents UTC time.
public static IsUtc ( this dto ) : bool
dto this
Результат bool

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

Subtracts 1 tick from the given time.
public static PreviousMoment ( this dt ) : System.DateTime
dt this
Результат System.DateTime

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

Subtracts 1 tick from the given time.
public static PreviousMoment ( this dt ) : DateTimeOffset
dt this
Результат DateTimeOffset

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

Returns quarter number 1..4
public static Quarter ( this dt ) : int
dt this
Результат int

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

public static ToDateTime ( this dto, DateTimeKind kind ) : System.DateTime
dto this
kind DateTimeKind
Результат System.DateTime

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

Converts date part of the date time to integer in the YYYYMMDD format.
public static ToSortableIntDate ( this dt ) : int
dt this
Результат int

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

Returns integer in the format of HHmmss or HHmmssFFF. Optional "FFF" is milliseconds.
public static ToSortableIntTime ( this dt, bool includeMilliseconds = false ) : int
dt this
includeMilliseconds bool
Результат int

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

Returns integer in the format of YYYYMMDDHHmmss or similar with fractional seconds.
public static ToSortableLongDateTime ( this dt, bool includeMilliseconds = false ) : long
dt this
includeMilliseconds bool
Результат long

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

Returns integer in the format of HHmmss or HHmmssFFF. Optional "FFF" is milliseconds.
public static ToSortableLongTime ( this dt, bool includeMilliseconds = false ) : long
dt this
includeMilliseconds bool
Результат long

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

Returns ISO-8601 week number in the year.
public static WeekOfYear ( this dt, CalendarWeekRule whatIsFirstWeek = CalendarWeekRule.FirstFourDayWeek ) : int
dt this
whatIsFirstWeek CalendarWeekRule /// Tells whether the first week can be a) any incomplete week, b) a week with 4 days or /// more, or c) full week only. ///
Результат int