Skip to content

intervals.utils.datetimeextensions

alexey edited this page Nov 16, 2022 · 3 revisions

< Back


DateTimeExtensions

Namespace: Intervals.Utils

public static class DateTimeExtensions

Inheritance ObjectDateTimeExtensions

Methods

Ceiling(DateTime, TimeSpan)

Returns the smallest value aligned to that is greater than or equal to the specified

public static DateTime Ceiling(DateTime dateTime, TimeSpan granuleSize)

Parameters

dateTime DateTime

granuleSize TimeSpan

Returns

DateTime

CeilingToMonth(DateTime)

Returns the smallest value aligned to month that is greater than or equal to the specified

public static DateTime CeilingToMonth(DateTime dateTime)

Parameters

dateTime DateTime

Returns

DateTime

CeilingToQuarter(DateTime)

Returns the smallest value aligned to quarter that is greater than or equal to the specified

public static DateTime CeilingToQuarter(DateTime dateTime)

Parameters

dateTime DateTime

Returns

DateTime

CeilingToHalfYear(DateTime)

Returns the smallest value aligned to half-year that is greater than or equal to the specified

public static DateTime CeilingToHalfYear(DateTime dateTime)

Parameters

dateTime DateTime

Returns

DateTime

CeilingToYear(DateTime)

Returns the smallest value aligned to year that is greater than or equal to the specified

public static DateTime CeilingToYear(DateTime dateTime)

Parameters

dateTime DateTime

Returns

DateTime

GetQuarter(DateTime)

Returns the quarter number for the specified

public static int GetQuarter(DateTime dateTime)

Parameters

dateTime DateTime

Returns

Int32
quarter number

GetHalfYear(DateTime)

Returns the half-year number for the specified

public static int GetHalfYear(DateTime dateTime)

Parameters

dateTime DateTime

Returns

Int32
half-year number

Floor(DateTime, TimeSpan)

Returns the largest value aligned to that is less than or equal to the specified

public static DateTime Floor(DateTime dateTime, TimeSpan granuleSize)

Parameters

dateTime DateTime

granuleSize TimeSpan

Returns

DateTime

FloorToMonth(DateTime)

Returns the largest value aligned to month that is less than or equal to the specified

public static DateTime FloorToMonth(DateTime dateTime)

Parameters

dateTime DateTime

Returns

DateTime

FloorToQuarter(DateTime)

Returns the largest value aligned to quarter that is less than or equal to the specified

public static DateTime FloorToQuarter(DateTime dateTime)

Parameters

dateTime DateTime

Returns

DateTime

FloorToHalfYear(DateTime)

Returns the largest value aligned to half-year that is less than or equal to the specified

public static DateTime FloorToHalfYear(DateTime dateTime)

Parameters

dateTime DateTime

Returns

DateTime

FloorToYear(DateTime)

Returns the largest value aligned to year that is less than or equal to the specified

public static DateTime FloorToYear(DateTime dateTime)

Parameters

dateTime DateTime

Returns

DateTime

Round(DateTime, TimeSpan, MidpointRounding)

Rounds a to a value aligned to , and uses the specified rounding convention for midpoint values.

public static DateTime Round(DateTime dateTime, TimeSpan granuleSize, MidpointRounding midpointRounding)

Parameters

dateTime DateTime

granuleSize TimeSpan

midpointRounding MidpointRounding

Returns

DateTime

RoundToMonth(DateTime, MidpointRounding)

Rounds a to a value aligned to month, and uses the specified rounding convention for midpoint values.

public static DateTime RoundToMonth(DateTime dateTime, MidpointRounding midpointRounding)

Parameters

dateTime DateTime

midpointRounding MidpointRounding

Returns

DateTime

RoundToQuarter(DateTime, MidpointRounding)

Rounds a to a value aligned to quarter, and uses the specified rounding convention for midpoint values.

public static DateTime RoundToQuarter(DateTime dateTime, MidpointRounding midpointRounding)

Parameters

dateTime DateTime

midpointRounding MidpointRounding

Returns

DateTime

RoundToHalfYear(DateTime, MidpointRounding)

Rounds a to a value aligned to half-year, and uses the specified rounding convention for midpoint values.

public static DateTime RoundToHalfYear(DateTime dateTime, MidpointRounding midpointRounding)

Parameters

dateTime DateTime

midpointRounding MidpointRounding

Returns

DateTime

RoundToYear(DateTime, MidpointRounding)

Rounds a to a value aligned to year, and uses the specified rounding convention for midpoint values.

public static DateTime RoundToYear(DateTime dateTime, MidpointRounding midpointRounding)

Parameters

dateTime DateTime

midpointRounding MidpointRounding

Returns

DateTime


< Back

Clone this wiki locally