subMonths

Modified on Tue, 22 Aug 2023

Description

Use this function to subtract the specified number of months from the given date.

Syntax

subMonths(date, number)

Returns

Return ValueDescription
DateReturns the resulting date after subtracting the specified number of months.

Sample

ExampleResultDescription
subMonths (2023-04-08, 2)2023-02-08Returns the output as 2023-02-08 after subtracting 2 months from the input date (2023-04-08).

To view all the Date functions, click here.

See Also