Skip to content

Modern Chrono LocalDate AddMonths

Paul Squires edited this page Oct 19, 2026 · 5 revisions

Home › Date and Time (Chrono) › Chrono Date and Time › LocalDate.AddMonths

LocalDate.AddMonths

Returns the date moved by whole months, clamping the day to the month's end.

Syntax

LocalDate.AddMonths( n )

Examples

#import "std/chrono"
using chrono

dim as LocalDate d = LocalDate( 2026, 1, 31 )

'' The day is CLAMPED to the end of the target month, never rolled over
'' into the next one
print d.AddMonths( 1 ).ToIsoString( )    '' 2026-02-28

'' Which means it does not round-trip: adding a month and subtracting it
'' does not always return the original day
print d.AddMonths( 1 ).AddMonths( -1 ).ToIsoString( )      '' 2026-01-28

Library: Chrono Date and Time
Category: Date and Time (Chrono)
Documented under: The Members

Clone this wiki locally