# QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Not applicable

## datediff

hi all,

how can i determine the difference in months between two given dates (in LOAD script) where the first date would always be the 1st month and the second date always be the nth month after the first date. example:

date 1: 2012-03-15

date 2: 2013-01-04

diff: 10

many thanks for some help!

1 Solution

Accepted Solutions
Honored Contributor III

## Re: datediff

Load DIV(Date#(date2,'YYYY-M-D') - Date#(date1,'YYYY-M-D'),30)+1;

Load * Inline [

date1,date2

2012-03-15, 2012-04-04 ]

3 Replies
Honored Contributor III

## Re: datediff

Load DIV(Date#(date2,'YYYY-M-D') - Date#(date1,'YYYY-M-D'),30)+1;

Load * Inline [

date1,date2

2012-03-15, 2012-04-04 ]

MVP

## Re: datediff

=Month(Date#('2013-01-04','YYYY-MM-DD')) + Year(Date#('2013-01-04','YYYY-MM-DD'))*12 - (Month(Date#('2012-03-15','YYYY-MM-DD')) + Year(Date#('2012-03-15','YYYY-MM-DD'))*12) as DateDifference

or

=Month(Date#(DATE2,'YYYY-MM-DD')) + Year(Date#(DATE1,'YYYY-MM-DD'))*12 - (Month(Date#(DATE2,'YYYY-MM-DD')) + Year(Date#(DATE1,'YYYY-MM-DD'))*12) as DateDifference

Honored Contributor III