Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Adding months to Date

Hi,

Is it possible within QlikView to add months to a date?

For example have this script:

set startDate = '01/01/2012'

set enddate = '01/04/2012'

let a=Interval(month(endDate)-month(startDate),'m');

for i = 0 to a;

let filename = Date(Date(startDate+i),'MM')&' '&Date(Date(startDate+i),'MMMM')&' '&YEAR(Date(startDate+i))&' - Data.xls';

the "startDate+i" is adding days.  How do I add this to the month instead?

Any help would be greatly appreciated.

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III

Hi

Use AddMonths(startdate, n) where startdate is the date you wish to add to, n is the number of months (negative for prior months)

     AddMonths('2012/05/25', 3)  ->  2012/08/25

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

2 Replies
Oleg_Troyansky
Partner Ambassador/MVP

jonathandienst
Partner - Champion III

Hi

Use AddMonths(startdate, n) where startdate is the date you wish to add to, n is the number of months (negative for prior months)

     AddMonths('2012/05/25', 3)  ->  2012/08/25

Regards

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein