Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor II
Contributor II

Format date YYYYMMDD as "integer"

Hi,

 

I would like to check how can I convert a date field to an integer field?

For example, formatting date "20190131" AS integer "20190131"

 

The original date format is date-time, and I have formatted it with "Date" function to extract the date in format "YYYYMMDD".

Load 

Date(EffectiveDate, 'YYYYMMDD') as Date_Key

Resident TableA;

 

Updated solution:

=> Convert Date to Text then Integer

Load 

Num#(TEXT(Date(EffectiveDate, 'YYYYMMDD'))) as Date_Key

Resident TableA;

 

Tags (2)
1 Solution

Accepted Solutions
Highlighted
MVP
MVP

Re: Format date YYYYMMDD as "number or integer"

I am not sure why you would wan to do this, but probably:

Num(Text(Date(EffectiveDate, 'YYYYMMDD'))) as Date_Key

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

View solution in original post

4 Replies
Highlighted
MVP
MVP

Re: Format date YYYYMMDD as "number or integer"

I am not sure why you would wan to do this, but probably:

Num(Text(Date(EffectiveDate, 'YYYYMMDD'))) as Date_Key

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

View solution in original post

Highlighted
Contributor II
Contributor II

Re: Format date YYYYMMDD as "number or integer"

Hi, thanks for the reply. I tested your method but it didn't work.

The output returns blank instead.

NUM(TEXT(DATE(EFFECTIVE_DATE,'YYYYMMDD'))) AS DATE_KEY

TEST1.PNG

 

 

Highlighted
Contributor II
Contributor II

Re: Format date YYYYMMDD as "number or integer"

Hi Jonty,

 

I retested your method with num#() and it works! Thanks so much 🙂

Highlighted
MVP
MVP

Re: Format date YYYYMMDD as "number or integer"

You  are absolutely correct - my bad.😀

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