Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Date comparison issue

Hi All,

I am facing a strange issue.

When I use the below expression for comparing the date format, it returns -1 even though the date format doesn't match.

IsNum((Date#('Mar 2015','MMMM YYYY'))) ,

When I use the below expression, it returns 0 as expected.

=IsNum((Date#('201501','YYYY-MM')))

It is just that this expression is not able to compare date in MMM and MMMM Format.

Is there anything wrong with the expression i am using?

Can we use a generic expression for comparing all the date formats?

Thanks,

Asma

6 Replies
Not applicable
Author

Try this...

=IsNum((Date#('Mar 2015','MON YYYY')))

vvvvvvizard
Partner - Specialist
Partner - Specialist

try IsNum((Date#('Mar 2015','MMM YYYY')))   with 3 M instead of 4

jonathandienst
Partner - Champion III
Partner - Champion III

Qlikview seems to treat MMM and MMMM interchangeably:

     Date#('Mar 2015','MMMM YYYY')

     Date#('March 2015','MMMM YYYY')

     Date#('Mar 2015','MMM YYYY')

     Date#('Mar 2015','MMMM YYYY')

all produce the same output. This returns null:

     Date#('Mar 2015','MM YYYY')

    

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

Irrespective of using 3Ms or 4Ms, the expression is always returning -1

Not applicable
Author

The expression =Date#('Mar 2015','MM YYYY') is returning Mar 2015

antoniotiman
Master III
Master III

Hi Asma,

Use Alt() function

From Guide :

Alt( date#( dat , 'YYYY/MM/DD' ),

date#( dat , 'MM/DD/YYYY' ),

date#( dat , 'MM/DD/YY' ),

'No valid date' )

Regards,

Antonio