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: 
julioarriaga
Creator II
Creator II

Why does the expression date('mm/dd/yyyy')>='mm/dd/yyyy' work independently of the format?

Hi everyone,

Thank you in advance for your time in answering this question.

How does QV know how to apply a criteria of '>=' to a date string independently of the formats? As these are basically different strings (image 1 and 2), shouldn't they give different results?

P.S. I know date is a formatting function but still the script registers it as a string.

image 1

Capture1.PNG

Image 2

Capture2.PNG

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

The simple answer is that Dates are not strings, they are Dual type. They have both a numeric value (the number of days since Dec 30, 1899) and a formatted string representation.  QV is smart enough to use either the numeric or string format depending on the context.  For example, when you do a comparison expression, the numeric value is used.  When you put the field in a listbox, the string is used.

-Rob

http://masterssummit.com

http://qlikviewcookbook.com

View solution in original post

4 Replies
sunny_talwar

What is the difference between the two images? Also, your date format should be DD/MM/YYYY and not 30/08/2017

julioarriaga
Creator II
Creator II
Author

Sorry, my bad, I just corrected the post

sunny_talwar

Why would you expect to get different results? You are using same date in two formats? Personally, I prefer to use MakeDate() function when do comparisons with date field

Where Bill_Date >= MakeDate(2017, 8, 30);

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

The simple answer is that Dates are not strings, they are Dual type. They have both a numeric value (the number of days since Dec 30, 1899) and a formatted string representation.  QV is smart enough to use either the numeric or string format depending on the context.  For example, when you do a comparison expression, the numeric value is used.  When you put the field in a listbox, the string is used.

-Rob

http://masterssummit.com

http://qlikviewcookbook.com