Qlik Community

Ask a Question

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Support Cases coming to Qlik Community Oct. 4! Start chats, open cases, explore resources: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
JJaky
Contributor II
Contributor II

converting a text to date and time

Hi all,

how can I convert this value '20210227112912' to 27/02/2021  and split time 11:29 to another column ? 

Thanks in advance!

Labels (3)
1 Solution

Accepted Solutions
Taoufiq_Zarra

@JJaky  you can use Timestamp#() like :

Timestamp(Timestamp#(Field,'YYYYMMDDHHmmss')) to convert your field to timestamp format

Date(Timestamp#(Field,'YYYYMMDDHHmmss'),'DD/MM/YYYY')to extract only date

Time(Timestamp#(Field,'YYYYMMDDHHmmss'),'HH:mm') to extract time

like this script:

load *,Timestamp(Timestamp#(Field,'YYYYMMDDHHmmss')) as NewField,Date(Timestamp#(Field,'YYYYMMDDHHmmss'),'DD/MM/YYYY') as DateField,
Time(Timestamp#(Field,'YYYYMMDDHHmmss'),'HH:mm') as TimeField
 inline [
Field
20210227112912

]

the output:

Taoufiq_Zarra_0-1614679581266.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

2 Replies
Taoufiq_Zarra

@JJaky  you can use Timestamp#() like :

Timestamp(Timestamp#(Field,'YYYYMMDDHHmmss')) to convert your field to timestamp format

Date(Timestamp#(Field,'YYYYMMDDHHmmss'),'DD/MM/YYYY')to extract only date

Time(Timestamp#(Field,'YYYYMMDDHHmmss'),'HH:mm') to extract time

like this script:

load *,Timestamp(Timestamp#(Field,'YYYYMMDDHHmmss')) as NewField,Date(Timestamp#(Field,'YYYYMMDDHHmmss'),'DD/MM/YYYY') as DateField,
Time(Timestamp#(Field,'YYYYMMDDHHmmss'),'HH:mm') as TimeField
 inline [
Field
20210227112912

]

the output:

Taoufiq_Zarra_0-1614679581266.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

JJaky
Contributor II
Contributor II
Author

@Taoufiq_Zarra , thanks a lot!