Noda Time
Show / Hide Table of Contents

Class DateAdjusters

Factory class for date adjusters: functions from LocalDate to LocalDate, which can be applied to LocalDate, LocalDateTime, and OffsetDateTime.
Since 2.0.x
Availability net45, netstandard1.3, netstandard2.0
Inheritance
Object
DateAdjusters
Inherited Members
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Namespace: NodaTime
Assembly: NodaTime.dll
Syntax
public static class DateAdjusters

Properties

EndOfMonth

A date adjuster to move to the last day of the current month.
Since 2.0.x
Availability net45, netstandard1.3, netstandard2.0
Declaration
public static Func<LocalDate, LocalDate> EndOfMonth { get; }
Property Value
Type Description
Func<LocalDate, LocalDate> A date adjuster to move to the last day of the current month. (The value returned is never null.)

StartOfMonth

A date adjuster to move to the first day of the current month.
Since 2.0.x
Availability net45, netstandard1.3, netstandard2.0
Declaration
public static Func<LocalDate, LocalDate> StartOfMonth { get; }
Property Value
Type Description
Func<LocalDate, LocalDate> A date adjuster to move to the first day of the current month. (The value returned is never null.)

Methods

DayOfMonth(Int32)

A date adjuster to move to the specified day of the current month.
Since 2.0.x
Availability net45, netstandard1.3, netstandard2.0
Declaration
public static Func<LocalDate, LocalDate> DayOfMonth(int day)
Parameters
Type Name Description
Int32 day The day of month to adjust dates to.
Returns
Type Description
Func<LocalDate, LocalDate> An adjuster which changes the day to day, retaining the same year and month. (The value returned is never null.)
Remarks
The returned adjuster will throw an exception if it is applied to a date that would create an invalid result.

Month(Int32)

A date adjuster to move to the same day of the specified month.
Since 2.0.x
Availability net45, netstandard1.3, netstandard2.0
Declaration
public static Func<LocalDate, LocalDate> Month(int month)
Parameters
Type Name Description
Int32 month The month to adjust dates to.
Returns
Type Description
Func<LocalDate, LocalDate> An adjuster which changes the month to month, retaining the same year and day of month. (The value returned is never null.)
Remarks
The returned adjuster will throw an exception if it is applied to a date that would create an invalid result.

Next(IsoDayOfWeek)

A date adjuster to move to the next specified day-of-week, adding a week if the day is already correct.
Since 2.0.x
Availability net45, netstandard1.3, netstandard2.0
Declaration
public static Func<LocalDate, LocalDate> Next(IsoDayOfWeek dayOfWeek)
Parameters
Type Name Description
IsoDayOfWeek dayOfWeek The day-of-week to adjust dates to.
Returns
Type Description
Func<LocalDate, LocalDate> An adjuster which advances a date to the next occurrence of the specified day-of-week. (The value returned is never null.)
Remarks
This is the adjuster equivalent of Next(IsoDayOfWeek).

NextOrSame(IsoDayOfWeek)

A date adjuster to move to the next specified day-of-week, but return the original date if the day is already correct.
Since 2.0.x
Availability net45, netstandard1.3, netstandard2.0
Declaration
public static Func<LocalDate, LocalDate> NextOrSame(IsoDayOfWeek dayOfWeek)
Parameters
Type Name Description
IsoDayOfWeek dayOfWeek The day-of-week to adjust dates to.
Returns
Type Description
Func<LocalDate, LocalDate> An adjuster which advances a date to the next occurrence of the specified day-of-week, or the original date if the day is already corret. (The value returned is never null.)

Previous(IsoDayOfWeek)

A date adjuster to move to the previous specified day-of-week, subtracting a week if the day is already correct.
Since 2.0.x
Availability net45, netstandard1.3, netstandard2.0
Declaration
public static Func<LocalDate, LocalDate> Previous(IsoDayOfWeek dayOfWeek)
Parameters
Type Name Description
IsoDayOfWeek dayOfWeek The day-of-week to adjust dates to.
Returns
Type Description
Func<LocalDate, LocalDate> An adjuster which advances a date to the previous occurrence of the specified day-of-week. (The value returned is never null.)
Remarks
This is the adjuster equivalent of Previous(IsoDayOfWeek).

PreviousOrSame(IsoDayOfWeek)

A date adjuster to move to the previous specified day-of-week, but return the original date if the day is already correct.
Since 2.0.x
Availability net45, netstandard1.3, netstandard2.0
Declaration
public static Func<LocalDate, LocalDate> PreviousOrSame(IsoDayOfWeek dayOfWeek)
Parameters
Type Name Description
IsoDayOfWeek dayOfWeek The day-of-week to adjust dates to.
Returns
Type Description
Func<LocalDate, LocalDate> An adjuster which advances a date to the previous occurrence of the specified day-of-week, or the original date if the day is already corret. (The value returned is never null.)
In this article
Back to top Generated by DocFX