C# Класс FluentDateTimeOffset.DateTimeOffsetExtensions

Static class containing Fluent DateTimeOffset extension methods.
Показать файл Открыть проект

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

Метод Описание
AddBusinessDays ( this current, int days ) : DateTimeOffset

Adds the given number of business days to the DateTimeOffset.

At ( this current, int hour, int minute ) : DateTimeOffset

Returns the given DateTimeOffset with hour and minutes set At given values.

At ( this current, int hour, int minute, int second ) : DateTimeOffset

Returns the given DateTimeOffset with hour and minutes and seconds set At given values.

At ( this current, int hour, int minute, int second, int milliseconds ) : DateTimeOffset

Returns the given DateTimeOffset with hour and minutes and seconds and milliseconds set At given values.

BeginningOfDay ( this date ) : DateTimeOffset

Returns the Start of the given day (the first millisecond of the given DateTimeOffset).

DecreaseTime ( this startDate, System.TimeSpan toSubtract ) : DateTimeOffset

Decreases the DateTimeOffset object with given TimeSpan value.

EndOfDay ( this date ) : DateTimeOffset

Returns the very end of the given day (the last millisecond of the last hour for the given DateTimeOffset).

FirstDayOfMonth ( this current ) : DateTimeOffset

Sets the day of the DateTimeOffset to the first day in that month.

FirstDayOfQuarter ( this current ) : DateTimeOffset

Sets the day of the DateTimeOffset to the first day in that calendar quarter. credit to http://www.devcurry.com/2009/05/find-first-and-last-day-of-current.html

FirstDayOfWeek ( this dateTime ) : DateTimeOffset

Returns a DateTimeOffset adjusted to the beginning of the week.

the beginning of the week is controlled by the current Culture

FirstDayOfYear ( this current ) : DateTimeOffset

Returns the first day of the year keeping the time component intact. Eg, 2011-02-04T06:40:20.005 => 2011-01-01T06:40:20.005

IncreaseTime ( this startDate, System.TimeSpan toAdd ) : DateTimeOffset

Increases the DateTimeOffset object with given TimeSpan value.

IsAfter ( this current, DateTimeOffset toCompareWith ) : bool

Determines whether the specified DateTimeOffset value is After then current value.

IsBefore ( this current, DateTimeOffset toCompareWith ) : bool

Determines whether the specified DateTimeOffset is before then current value.

IsInFuture ( this dateTime ) : bool

Determine if a DateTimeOffset is in the future.

IsInPast ( this dateTime ) : bool

Determine if a DateTimeOffset is in the past.

LastDayOfMonth ( this current ) : DateTimeOffset

Sets the day of the DateTimeOffset to the last day in that month.

LastDayOfQuarter ( this current ) : DateTimeOffset

Sets the day of the DateTimeOffset to the last day in that calendar quarter. credit to http://www.devcurry.com/2009/05/find-first-and-last-day-of-current.html

LastDayOfWeek ( this current ) : DateTimeOffset

Returns the last day of the week keeping the time component intact. Eg, 2011-12-24T06:40:20.005 => 2011-12-25T06:40:20.005

LastDayOfYear ( this current ) : DateTimeOffset

Returns the last day of the year keeping the time component intact. Eg, 2011-12-24T06:40:20.005 => 2011-12-31T06:40:20.005

Midnight ( this value ) : DateTimeOffset

Returns original DateTimeOffset value with time part set to midnight (alias for BeginningOfDay method).

Next ( this start, DayOfWeek day ) : DateTimeOffset

Returns first next occurrence of specified DayOfWeek.

NextDay ( this start ) : DateTimeOffset

Returns DateTimeOffset increased by 24 hours ie Next Day.

NextMonth ( this current ) : DateTimeOffset

Returns the next month keeping the time component intact. Eg, 2012-12-05T06:40:20.005 => 2013-01-05T06:40:20.005 If the next month doesn't have that many days the last day of the next month is used. Eg, 2013-01-31T06:40:20.005 => 2013-02-28T06:40:20.005

NextYear ( this start ) : DateTimeOffset

Returns the same date (same Day, Month, Hour, Minute, Second etc) in the next calendar year. If that day does not exist in next year in same month, number of missing days is added to the last day in same month next year.

Noon ( this value ) : DateTimeOffset

Returns original DateTimeOffset value with time part set to Noon (12:00:00h).

Previous ( this start, DayOfWeek day ) : DateTimeOffset

Returns first next occurrence of specified DayOfWeek.

PreviousDay ( this start ) : DateTimeOffset

Returns DateTimeOffset decreased by 24h period ie Previous Day.

PreviousMonth ( this current ) : DateTimeOffset

Returns the previous month keeping the time component intact. Eg, 2010-01-20T06:40:20.005 => 2009-12-20T06:40:20.005 If the previous month doesn't have that many days the last day of the previous month is used. Eg, 2009-03-31T06:40:20.005 => 2009-02-28T06:40:20.005

PreviousYear ( this start ) : DateTimeOffset

Returns the same date (same Day, Month, Hour, Minute, Second etc) in the previous calendar year. If that day does not exist in previous year in same month, number of missing days is added to the last day in same month previous year.

Round ( this dateTime, RoundTo rt ) : DateTimeOffset
SameDay ( this current, DateTimeOffset date ) : bool

Determines whether the specified DateTimeOffset value is exactly the same day (day + month + year) then current

SameMonth ( this current, DateTimeOffset date ) : bool

Determines whether the specified DateTimeOffset value is exactly the same month (month + year) then current. Eg, 2015-12-01 and 2014-12-01 => False

SameYear ( this current, DateTimeOffset date ) : bool

Determines whether the specified DateTimeOffset value is exactly the same year then current. Eg, 2015-12-01 and 2015-01-01 => True

SetDate ( this value, int year ) : DateTimeOffset

Returns DateTimeOffset with changed Year part.

SetDate ( this value, int year, int month ) : DateTimeOffset

Returns DateTimeOffset with changed Year and Month part.

SetDate ( this value, int year, int month, int day ) : DateTimeOffset

Returns DateTimeOffset with changed Year, Month and Day part.

SetDay ( this value, int day ) : DateTimeOffset

Returns DateTimeOffset with changed Day part.

SetHour ( this originalDate, int hour ) : DateTimeOffset

Returns DateTimeOffset with changed Hour part.

SetMillisecond ( this originalDate, int millisecond ) : DateTimeOffset

Returns DateTimeOffset with changed Millisecond part.

SetMinute ( this originalDate, int minute ) : DateTimeOffset

Returns DateTimeOffset with changed Minute part.

SetMonth ( this value, int month ) : DateTimeOffset

Returns DateTimeOffset with changed Month part.

SetSecond ( this originalDate, int second ) : DateTimeOffset

Returns DateTimeOffset with changed Second part.

SetTime ( this originalDate, int hour ) : DateTimeOffset

Returns the original DateTimeOffset with Hour part changed to supplied hour parameter.

SetTime ( this originalDate, int hour, int minute ) : DateTimeOffset

Returns the original DateTimeOffset with Hour and Minute parts changed to supplied hour and minute parameters.

SetTime ( this originalDate, int hour, int minute, int second ) : DateTimeOffset

Returns the original DateTimeOffset with Hour, Minute and Second parts changed to supplied hour, minute and second parameters.

SetTime ( this originalDate, int hour, int minute, int second, int millisecond ) : DateTimeOffset

Returns the original DateTimeOffset with Hour, Minute, Second and Millisecond parts changed to supplied hour, minute, second and millisecond parameters.

SetYear ( this value, int year ) : DateTimeOffset

Returns DateTimeOffset with changed Year part.

SubtractBusinessDays ( this current, int days ) : DateTimeOffset

Subtracts the given number of business days to the DateTimeOffset.

WeekAfter ( this start ) : DateTimeOffset

Increases supplied DateTimeOffset for 7 days ie returns the Next Week.

WeekEarlier ( this start ) : DateTimeOffset

Decreases supplied DateTimeOffset for 7 days ie returns the Previous Week.

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

Метод Описание
StartOfWeek ( this dateTime ) : DateTimeOffset

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

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

Adds the given number of business days to the DateTimeOffset.
public static AddBusinessDays ( this current, int days ) : DateTimeOffset
current this The date to be changed.
days int Number of business days to be added.
Результат DateTimeOffset

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

Returns the given DateTimeOffset with hour and minutes set At given values.
public static At ( this current, int hour, int minute ) : DateTimeOffset
current this The current to be changed.
hour int The hour to set time to.
minute int The minute to set time to.
Результат DateTimeOffset

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

Returns the given DateTimeOffset with hour and minutes and seconds set At given values.
public static At ( this current, int hour, int minute, int second ) : DateTimeOffset
current this The current to be changed.
hour int The hour to set time to.
minute int The minute to set time to.
second int The second to set time to.
Результат DateTimeOffset

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

Returns the given DateTimeOffset with hour and minutes and seconds and milliseconds set At given values.
public static At ( this current, int hour, int minute, int second, int milliseconds ) : DateTimeOffset
current this The current to be changed.
hour int The hour to set time to.
minute int The minute to set time to.
second int The second to set time to.
milliseconds int The milliseconds to set time to.
Результат DateTimeOffset

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

Returns the Start of the given day (the first millisecond of the given DateTimeOffset).
public static BeginningOfDay ( this date ) : DateTimeOffset
date this
Результат DateTimeOffset

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

Decreases the DateTimeOffset object with given TimeSpan value.
public static DecreaseTime ( this startDate, System.TimeSpan toSubtract ) : DateTimeOffset
startDate this
toSubtract System.TimeSpan
Результат DateTimeOffset

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

Returns the very end of the given day (the last millisecond of the last hour for the given DateTimeOffset).
public static EndOfDay ( this date ) : DateTimeOffset
date this
Результат DateTimeOffset

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

Sets the day of the DateTimeOffset to the first day in that month.
public static FirstDayOfMonth ( this current ) : DateTimeOffset
current this The current to be changed.
Результат DateTimeOffset

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

Sets the day of the DateTimeOffset to the first day in that calendar quarter. credit to http://www.devcurry.com/2009/05/find-first-and-last-day-of-current.html
public static FirstDayOfQuarter ( this current ) : DateTimeOffset
current this
Результат DateTimeOffset

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

Returns a DateTimeOffset adjusted to the beginning of the week.
the beginning of the week is controlled by the current Culture
public static FirstDayOfWeek ( this dateTime ) : DateTimeOffset
dateTime this The DateTimeOffset to adjust
Результат DateTimeOffset

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

Returns the first day of the year keeping the time component intact. Eg, 2011-02-04T06:40:20.005 => 2011-01-01T06:40:20.005
public static FirstDayOfYear ( this current ) : DateTimeOffset
current this The DateTimeOffset to adjust
Результат DateTimeOffset

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

Increases the DateTimeOffset object with given TimeSpan value.
public static IncreaseTime ( this startDate, System.TimeSpan toAdd ) : DateTimeOffset
startDate this
toAdd System.TimeSpan
Результат DateTimeOffset

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

Determines whether the specified DateTimeOffset value is After then current value.
public static IsAfter ( this current, DateTimeOffset toCompareWith ) : bool
current this The current value.
toCompareWith DateTimeOffset Value to compare with.
Результат bool

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

Determines whether the specified DateTimeOffset is before then current value.
public static IsBefore ( this current, DateTimeOffset toCompareWith ) : bool
current this The current value.
toCompareWith DateTimeOffset Value to compare with.
Результат bool

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

Determine if a DateTimeOffset is in the future.
public static IsInFuture ( this dateTime ) : bool
dateTime this The date to be checked.
Результат bool

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

Determine if a DateTimeOffset is in the past.
public static IsInPast ( this dateTime ) : bool
dateTime this The date to be checked.
Результат bool

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

Sets the day of the DateTimeOffset to the last day in that month.
public static LastDayOfMonth ( this current ) : DateTimeOffset
current this The current DateTimeOffset to be changed.
Результат DateTimeOffset

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

Sets the day of the DateTimeOffset to the last day in that calendar quarter. credit to http://www.devcurry.com/2009/05/find-first-and-last-day-of-current.html
public static LastDayOfQuarter ( this current ) : DateTimeOffset
current this
Результат DateTimeOffset

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

Returns the last day of the week keeping the time component intact. Eg, 2011-12-24T06:40:20.005 => 2011-12-25T06:40:20.005
public static LastDayOfWeek ( this current ) : DateTimeOffset
current this The DateTimeOffset to adjust
Результат DateTimeOffset

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

Returns the last day of the year keeping the time component intact. Eg, 2011-12-24T06:40:20.005 => 2011-12-31T06:40:20.005
public static LastDayOfYear ( this current ) : DateTimeOffset
current this The DateTimeOffset to adjust
Результат DateTimeOffset

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

Returns original DateTimeOffset value with time part set to midnight (alias for BeginningOfDay method).
public static Midnight ( this value ) : DateTimeOffset
value this
Результат DateTimeOffset

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

Returns first next occurrence of specified DayOfWeek.
public static Next ( this start, DayOfWeek day ) : DateTimeOffset
start this
day DayOfWeek
Результат DateTimeOffset

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

Returns DateTimeOffset increased by 24 hours ie Next Day.
public static NextDay ( this start ) : DateTimeOffset
start this
Результат DateTimeOffset

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

Returns the next month keeping the time component intact. Eg, 2012-12-05T06:40:20.005 => 2013-01-05T06:40:20.005 If the next month doesn't have that many days the last day of the next month is used. Eg, 2013-01-31T06:40:20.005 => 2013-02-28T06:40:20.005
public static NextMonth ( this current ) : DateTimeOffset
current this The DateTimeOffset to adjust
Результат DateTimeOffset

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

Returns the same date (same Day, Month, Hour, Minute, Second etc) in the next calendar year. If that day does not exist in next year in same month, number of missing days is added to the last day in same month next year.
public static NextYear ( this start ) : DateTimeOffset
start this
Результат DateTimeOffset

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

Returns original DateTimeOffset value with time part set to Noon (12:00:00h).
public static Noon ( this value ) : DateTimeOffset
value this The find Noon for.
Результат DateTimeOffset

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

Returns first next occurrence of specified DayOfWeek.
public static Previous ( this start, DayOfWeek day ) : DateTimeOffset
start this
day DayOfWeek
Результат DateTimeOffset

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

Returns DateTimeOffset decreased by 24h period ie Previous Day.
public static PreviousDay ( this start ) : DateTimeOffset
start this
Результат DateTimeOffset

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

Returns the previous month keeping the time component intact. Eg, 2010-01-20T06:40:20.005 => 2009-12-20T06:40:20.005 If the previous month doesn't have that many days the last day of the previous month is used. Eg, 2009-03-31T06:40:20.005 => 2009-02-28T06:40:20.005
public static PreviousMonth ( this current ) : DateTimeOffset
current this The DateTimeOffset to adjust
Результат DateTimeOffset

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

Returns the same date (same Day, Month, Hour, Minute, Second etc) in the previous calendar year. If that day does not exist in previous year in same month, number of missing days is added to the last day in same month previous year.
public static PreviousYear ( this start ) : DateTimeOffset
start this
Результат DateTimeOffset

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

public static Round ( this dateTime, RoundTo rt ) : DateTimeOffset
dateTime this
rt RoundTo
Результат DateTimeOffset

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

Determines whether the specified DateTimeOffset value is exactly the same day (day + month + year) then current
public static SameDay ( this current, DateTimeOffset date ) : bool
current this The current value
date DateTimeOffset Value to compare with
Результат bool

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

Determines whether the specified DateTimeOffset value is exactly the same month (month + year) then current. Eg, 2015-12-01 and 2014-12-01 => False
public static SameMonth ( this current, DateTimeOffset date ) : bool
current this The current value
date DateTimeOffset Value to compare with
Результат bool

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

Determines whether the specified DateTimeOffset value is exactly the same year then current. Eg, 2015-12-01 and 2015-01-01 => True
public static SameYear ( this current, DateTimeOffset date ) : bool
current this The current value
date DateTimeOffset Value to compare with
Результат bool

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

Returns DateTimeOffset with changed Year part.
public static SetDate ( this value, int year ) : DateTimeOffset
value this
year int
Результат DateTimeOffset

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

Returns DateTimeOffset with changed Year and Month part.
public static SetDate ( this value, int year, int month ) : DateTimeOffset
value this
year int
month int
Результат DateTimeOffset

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

Returns DateTimeOffset with changed Year, Month and Day part.
public static SetDate ( this value, int year, int month, int day ) : DateTimeOffset
value this
year int
month int
day int
Результат DateTimeOffset

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

Returns DateTimeOffset with changed Day part.
public static SetDay ( this value, int day ) : DateTimeOffset
value this
day int
Результат DateTimeOffset

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

Returns DateTimeOffset with changed Hour part.
public static SetHour ( this originalDate, int hour ) : DateTimeOffset
originalDate this
hour int
Результат DateTimeOffset

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

Returns DateTimeOffset with changed Millisecond part.
public static SetMillisecond ( this originalDate, int millisecond ) : DateTimeOffset
originalDate this
millisecond int
Результат DateTimeOffset

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

Returns DateTimeOffset with changed Minute part.
public static SetMinute ( this originalDate, int minute ) : DateTimeOffset
originalDate this
minute int
Результат DateTimeOffset

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

Returns DateTimeOffset with changed Month part.
public static SetMonth ( this value, int month ) : DateTimeOffset
value this
month int
Результат DateTimeOffset

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

Returns DateTimeOffset with changed Second part.
public static SetSecond ( this originalDate, int second ) : DateTimeOffset
originalDate this
second int
Результат DateTimeOffset

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

Returns the original DateTimeOffset with Hour part changed to supplied hour parameter.
public static SetTime ( this originalDate, int hour ) : DateTimeOffset
originalDate this
hour int
Результат DateTimeOffset

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

Returns the original DateTimeOffset with Hour and Minute parts changed to supplied hour and minute parameters.
public static SetTime ( this originalDate, int hour, int minute ) : DateTimeOffset
originalDate this
hour int
minute int
Результат DateTimeOffset

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

Returns the original DateTimeOffset with Hour, Minute and Second parts changed to supplied hour, minute and second parameters.
public static SetTime ( this originalDate, int hour, int minute, int second ) : DateTimeOffset
originalDate this
hour int
minute int
second int
Результат DateTimeOffset

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

Returns the original DateTimeOffset with Hour, Minute, Second and Millisecond parts changed to supplied hour, minute, second and millisecond parameters.
public static SetTime ( this originalDate, int hour, int minute, int second, int millisecond ) : DateTimeOffset
originalDate this
hour int
minute int
second int
millisecond int
Результат DateTimeOffset

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

Returns DateTimeOffset with changed Year part.
public static SetYear ( this value, int year ) : DateTimeOffset
value this
year int
Результат DateTimeOffset

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

Subtracts the given number of business days to the DateTimeOffset.
public static SubtractBusinessDays ( this current, int days ) : DateTimeOffset
current this The date to be changed.
days int Number of business days to be subtracted.
Результат DateTimeOffset

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

Increases supplied DateTimeOffset for 7 days ie returns the Next Week.
public static WeekAfter ( this start ) : DateTimeOffset
start this
Результат DateTimeOffset

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

Decreases supplied DateTimeOffset for 7 days ie returns the Previous Week.
public static WeekEarlier ( this start ) : DateTimeOffset
start this
Результат DateTimeOffset