C# Class Aspectacular.DateTimeExtensions

Contains utility & convenience DateTime methods
Afficher le fichier Open project: vgribok/Aspectacular

Méthodes publiques

Méthode Description
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.

Method Details

FromSortableIntDateTime() public static méthode

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
Résultat System.DateTime

FromSortableIntDateTime() public static méthode

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
Résultat DateTime?

FromSortableIntTime() public static méthode

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.
Résultat System.DateTime

FromSortableIntTime() public static méthode

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.
Résultat DateTime?

GoTo() public static méthode

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
Résultat System.DateTime

GoTo() public static méthode

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
Résultat DateTimeOffset

IsUtc() public static méthode

Returns true if DateTimeOffset represents UTC time.
public static IsUtc ( this dto ) : bool
dto this
Résultat bool

PreviousMoment() public static méthode

Subtracts 1 tick from the given time.
public static PreviousMoment ( this dt ) : System.DateTime
dt this
Résultat System.DateTime

PreviousMoment() public static méthode

Subtracts 1 tick from the given time.
public static PreviousMoment ( this dt ) : DateTimeOffset
dt this
Résultat DateTimeOffset

Quarter() public static méthode

Returns quarter number 1..4
public static Quarter ( this dt ) : int
dt this
Résultat int

ToDateTime() public static méthode

public static ToDateTime ( this dto, DateTimeKind kind ) : System.DateTime
dto this
kind DateTimeKind
Résultat System.DateTime

ToSortableIntDate() public static méthode

Converts date part of the date time to integer in the YYYYMMDD format.
public static ToSortableIntDate ( this dt ) : int
dt this
Résultat int

ToSortableIntTime() public static méthode

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
Résultat int

ToSortableLongDateTime() public static méthode

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
Résultat long

ToSortableLongTime() public static méthode

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
Résultat long

WeekOfYear() public static méthode

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. ///
Résultat int