Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join this live chat April 6, 10AM EST - QlikView to Qlik Sense REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
varunreddy
Creator III
Creator III

String to Date

Hi All,

I have date in 'MMM DD YYYY' format.

I am trying to get the data after 8/8/2015. So I am trying to convert the string into Date.

I am trying something like this:

=if(Date(Date#([As of Date],'MMM DD YYYY'),'MM/DD/YYYY')>='08/08/2015', 'Yes', 'No')

This is working only if, Month is greater than 'August'. If I select Jan 10 2016, it is dispalying the output as 'No'. I want to display it as 'Yes', as it is greater than 8/8/2015

Thanks in advance.

Best Regards,

Varun Reddy

1 Solution

Accepted Solutions
sunny_talwar

Can you try this:

=If(Num(Date#([As of Date], 'MMM DD YYYY')) >= Num(MakeDate(2015, 8, 8)), 'Yes', 'No')

UPDATE: Tried a sample and it seems to work:

Table:

LOAD *,

  If(Num(Date#([As of Date], 'MMM DD YYYY')) >= Num(MakeDate(2015, 8, 8)), 'Yes', 'No') as Flag;

LOAD * Inline [

As of Date

Jan 10 2016

];


Capture.PNG

View solution in original post

11 Replies
sunny_talwar

Can you try this:

=If(Num(Date#([As of Date], 'MMM DD YYYY')) >= Num(MakeDate(2015, 8, 8)), 'Yes', 'No')

UPDATE: Tried a sample and it seems to work:

Table:

LOAD *,

  If(Num(Date#([As of Date], 'MMM DD YYYY')) >= Num(MakeDate(2015, 8, 8)), 'Yes', 'No') as Flag;

LOAD * Inline [

As of Date

Jan 10 2016

];


Capture.PNG

View solution in original post

varunreddy
Creator III
Creator III
Author

Hi Sunny,

Why are we using Num?

maxgro
MVP
MVP

=if(Date#([As of Date], 'MMM DD YYYY')>=MakeDate(2015,8,8), 'Yes', 'No')

varunreddy
Creator III
Creator III
Author

Hi Maxgro,

Could you please explain we using Makedate?

sunny_talwar

You don't have to use it, but I like to do a date comparison in terms of numbers rather than in terms of date.

sunny_talwar

Some information on MakeDate() -> makedate ‒ QlikView

Generally, it is used to create a date

varunreddy
Creator III
Creator III
Author

Sunny,

Thanks for the Quick response. Could you please explain the reason why are we using make date?

Regards,

Varun

varunreddy
Creator III
Creator III
Author

Thanks Sunny

rubenmarin

Seems it's working for me just like you said, maybe is something different? or I didn't get where was the problem?

edit:lot of conversation while I was testing, I should remember to refresh the page