Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

vanlash8
New Contributor II

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
Honored Contributor III

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

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

5 Replies
shraddha_g
Honored Contributor III

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

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

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

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
Honored Contributor III

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

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

vanlash8
New Contributor II

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

Hi Antonio,

That was what I needed.  Thank you so much.

vanlash8
New Contributor II

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

Everyone who replied,

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

Thanks again!!