Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
eyadelnagdy
Contributor II
Contributor II

converting data type from string to data and time

Hello everyone,

in qlik sense

I have a timestamp in a string format and I need to convert it into a date and time with e specific format.

the idea is to be able to create a calendar or extracts month.week...etc from that field, which is not possible when it's a string

 

Labels (1)
5 Replies
henrikalmen
Specialist
Specialist

Use the date#() function.

eyadelnagdy
Contributor II
Contributor II
Author

when I use date#(fieldname) it generated another column which is actually the same

if I try to do Month(date#(filename)) it doesn't extract the month which means it doesn't understand it as a date

henrikalmen
Specialist
Specialist

No, you need to specify the format. If your date in a field MyDateField
is a text value like '09/12/24 13:00' then you do date#(MyDateField,
'DD/MM/YY hh:mm').

Please read the manual for the date#() function that I linked to.
BrunPierre
Partner - Master
Partner - Master

Date(Floor(Date#(Field,'YYYY-MM-DD hh:mm:ss.fffffff +ff:ff')),'DateFormat')

eyadelnagdy
Contributor II
Contributor II
Author

I found an easier solution. I used left(fieldname, 19) to extract the first 19 characters which includes the seconds and qlik recognised automatically the date and time