Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

cancel
Showing results for 
Search instead for 
Did you mean: 
saumyashah90
Specialist
Specialist

How to calculate no. days between two dates in a text box.?

I have date 1/11/2002  and 1/11/2013

I want no. of days between them

1 Solution

Accepted Solutions
Sokkorn
Master
Master

Hi Saumya,

If you want to calculate without exclude any holiday, then you can use =Date2-Date1

And if you want to calculate working day, then use =Networkdays (StartDate, EndDate {, Holiday})

The Networkdays () returns the number of working days (Monday-Friday) between and including StartDate and EndDate taking into account any optionally listed holidays. All parameters should be valid dates or timestamps.

Examples:

networkdays ('2007-02-19', '2007-03-01') returns 9 

networkdays ('2006-12-18', '2006-12-31', '2006-12-25', '2006-12-26') returns 8 

Regards,

Sokkorn

View solution in original post

7 Replies
jonbrough
Specialist
Specialist

Just minus the lower one from the higher one.

You'll need to make sure they are dates and not strings. Dates are stored as strings and numbers, so subraction should work.

You may want to wrap a Floor() function around them so that the date is seen as a whole number.

Jonathan

tresesco
MVP
MVP

By simply subtracting two dates you get the the difference in days.

=Date1-Date2 , will give you the difference in days.

saumyashah90
Specialist
Specialist
Author

Nope Not working

saumyashah90
Specialist
Specialist
Author

Nope Not working

I want it in Text box.....it is showing -

Sokkorn
Master
Master

Hi Saumya,

If you want to calculate without exclude any holiday, then you can use =Date2-Date1

And if you want to calculate working day, then use =Networkdays (StartDate, EndDate {, Holiday})

The Networkdays () returns the number of working days (Monday-Friday) between and including StartDate and EndDate taking into account any optionally listed holidays. All parameters should be valid dates or timestamps.

Examples:

networkdays ('2007-02-19', '2007-03-01') returns 9 

networkdays ('2006-12-18', '2006-12-31', '2006-12-25', '2006-12-26') returns 8 

Regards,

Sokkorn

View solution in original post

Sokkorn
Master
Master

Or if you want to test with your earlier post then use =Date#('1/11/2013','dd/MM/yyyy')-Date#('1/11/2002','dd/MM/yyyy')

tresesco
MVP
MVP

Are you trying with the specific dates. If so then try this in the text box:

=Date#('1/11/2013', 'DD/MM/YYYY') - Date#('1/11/2002' , 'DD/MM/YYYY')

Its all about the right date format.