Skip to main content

addmonths - script and chart function

This function returns the date occurring n months after startdate or, if n is negative, the date occurring n months before startdate.

Syntax:  

AddMonths(startdate, n , [ , mode])

Return data type: dual

Arguments:  

AddMonths arguments
Argument Description
startdate The start date as a time stamp, for example '2012-10-12'.
n Number of months as a positive or negative integer.
mode mode specifies if the month is added relative to the beginning of the month or relative to the end of the month. If the input date is the 28th or above and mode is set to 1, the function will return a date which is the same distance from the end of the month as the input date. Default mode is 0.

Examples and results:  

Examples and results
Example Result
addmonths ('2003-01-29',3) returns '2003-04-29'
addmonths ('2003-01-29',3,0) returns '2003-04-29'
addmonths ('2003-01-29',3,1) returns '2003-04-28'
addmonths ('2003-01-29',1,0) returns '2003-02-28'
addmonths ('2003-01-29',1,1) returns '2003-02-26'
addmonths ('2003-02-28',1,0) returns '2003-03-28'
addmonths ('2003-02-28',1,1) returns '2003-03-31'

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!

Join the Analytics Modernization Program

Remove banner from view

Modernize without compromising your valuable QlikView apps with the Analytics Modernization Program. Click here for more information or reach out: ampquestions@qlik.com