Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
lanlizgu
Creator III
Creator III

Convert date to numeric

Based on the following data 

 

TestTemp:
load * Inline
[
TestDate
01/01/2010
];

load
Date(Date#(TestDate),'YYYYMMDD') as DateNum


Resident TestTemp;

drop table TestTemp;

 

 

I want the DateNum field to be numeric YYYYMMDD. At the moment, it mantains the date format, as if I export it to excel I see it like DD/MM/YYYY.

If I formt it as num I'm not seeing the YYYYMMDD  integer but other value.

Labels (1)
1 Solution

Accepted Solutions
Taoufiq_Zarra

at worst you can use

TestTemp:
load * Inline
[
TestDate
01/01/2010
];

load
num(left(Date(TestDate,'YYYYMMDD'),4)&left(right(Date(TestDate,'YYYYMMDD'),4),2)&right(Date(TestDate,'YYYYMMDD'),2)) as DateNum


Resident TestTemp;

drop table TestTemp;

 

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

1 Reply
Taoufiq_Zarra

at worst you can use

TestTemp:
load * Inline
[
TestDate
01/01/2010
];

load
num(left(Date(TestDate,'YYYYMMDD'),4)&left(right(Date(TestDate,'YYYYMMDD'),4),2)&right(Date(TestDate,'YYYYMMDD'),2)) as DateNum


Resident TestTemp;

drop table TestTemp;

 

Capture.PNG

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉