Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
JJaky
Contributor III
Contributor III

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") 😉
JJaky
Contributor III
Contributor III
Author

@Taoufiq_Zarra , thanks a lot!