Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

AddMonths Date Function

Hi,

Any one pls explain how it will calculate internally and display the result..

what is mode -- 1 , how it will consider

addmonths ('2003-01-29',3,1) returns '2003-04-28'

addmonths ('2003-01-29',1,1) returns '2003-02-26'

addmonths ('2003-02-28',1,1) returns '2003-03-31'

Thanks in advance..

Sub2u

1 Reply
robert_mika
Master III
Master III

addmonths ('2003-01-29',3,1) returns '2003-04-28'


January has 31 days an we are at 29 of January adding 3 months give us 28 of April


Whereas

addmonths ('2003-01-29',3,0)

will return :


'2003-04-29'

exactly 3 months after 29 of january

Same for

addmonths ('2003-01-29',1,1) returns '2003-02-26'


January has 31 days and February 28 so two days from End of month.


and

addmonths ('2003-02-28',1,1) returns '2003-03-31'