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: 
teruru
Contributor III
Contributor III

Data type conversion

Hi,

I'd like to change the data type from number to timestamp.
I write like below, but it doesn't work.
"timestamp#(check_day)"

How can I change the number to date?
ex) 20230928112233 -> 2023/09/28 11:22:33

Thank you.

1 Solution

Accepted Solutions
jonashertz
Contributor III
Contributor III

Try using the hash timestamp#(field, 'format') function to identify year, month etc from your field.

Second step use the "regular" timestamp(field, 'format') function and specify which format you wish to use.

Note the timestamp# function will convert the value to a dual with a numerical presentation and a text representation. The timestamp function can then be used to modify the text representation to whatever you want 🙂 

EDIT: no need to wrap a numeric field with text actually..

t1:
Load
timestamp(timestamp#(number_timestamp,'YYYYMMDDhhmmss'),'YYYY/MM/DD hh:mm:ss') as formatted_timestamp;
load * Inline [
number_timestamp
20230928112233
];

View solution in original post

2 Replies
jonashertz
Contributor III
Contributor III

Try using the hash timestamp#(field, 'format') function to identify year, month etc from your field.

Second step use the "regular" timestamp(field, 'format') function and specify which format you wish to use.

Note the timestamp# function will convert the value to a dual with a numerical presentation and a text representation. The timestamp function can then be used to modify the text representation to whatever you want 🙂 

EDIT: no need to wrap a numeric field with text actually..

t1:
Load
timestamp(timestamp#(number_timestamp,'YYYYMMDDhhmmss'),'YYYY/MM/DD hh:mm:ss') as formatted_timestamp;
load * Inline [
number_timestamp
20230928112233
];

teruru
Contributor III
Contributor III
Author

Thank you so much!