Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to convert a class function integer date format to date format

Hello,

I am using the following: 

Class(if(Not IsNull(date(PDate)) and

Date(PDate) >= Today()-91 and date(PDate) < today(), date(PDate)),7,'to')

The date comes out as an integer, I need it to be in MM-DD-YYYY format.  I wasn't able to find anything in the forum or help.  I've already used the date(PO_Create_Date) function, but it still is returning only the date integer.

Any ideas, please?

classfunction.png

1 Solution

Accepted Solutions
antoniotiman
Master III
Master III

Hi Michele,

You can use Floor() instead of Class(), like this

if(Date >= Today()-91 and Date < today(),
Date(Floor(Date,7))&' to '&Date(Floor(Date
,7)+6))

Regards,

Antonio

View solution in original post

5 Replies
shraddha_g
Partner - Master III
Partner - Master III

try Date(num#(PDate),'MM-DD-YYYY')

marcus_sommer

AFAIK this couldn't be simply formatted - I think you will need something like this:

= date(subfield(class(if(PDate >= Today()-91 and PDate < today(), PDate), 7, 'to'), ' <= to < ', 1))

   & ' <= to < ' &

   date(subfield(class(if(PDate >= Today()-91 and PDate < today(), PDate), 7, 'to'), ' <= to < ', 2))

- Marcus

antoniotiman
Master III
Master III

Hi Michele,

You can use Floor() instead of Class(), like this

if(Date >= Today()-91 and Date < today(),
Date(Floor(Date,7))&' to '&Date(Floor(Date
,7)+6))

Regards,

Antonio

Anonymous
Not applicable
Author

Hi Antonio,

That was what I needed.  Thank you so much.

Anonymous
Not applicable
Author

Everyone who replied,

Thanks for taking the time to reply.  Very appreciated.  It turned out that Antonio's solution worked for me.

Thanks again!!