Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
PrashantRupani
Creator
Creator

Convert string to date/time

I've a a string in my database as Start Date : 01/01/2011 12:21:34 and End Date as 01/07/2011 18:31:45. 

I would like load as a date/time format in qlik sense when I load data in the script so it is easy to subtract two dates.

I want Qlik Sense script to recognize and convert to date/time when loading the data . 

How can I achieve this?

Thanks

 

 

3 Replies
MayilVahanan

Hi Prashant,

If your date format is in string, try like below

Load *, Date(Timestamp#(StartDate,'DD/MM/YYYY HH:mm:ss')) as StartDate,

Time(Timestamp#(StartDate,'DD/MM/YYYY HH:mm:ss')) as StartTime

from urtable;

Same for End Date.

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
ManimekalaiS
Partner - Contributor
Partner - Contributor

IF(ISNULL(StartDate),'',Date(Date#(StartDate, 'DD/MM/YYYY'), 'DD/MM/YYYY')) as StartDate
ManimekalaiS
Partner - Contributor
Partner - Contributor

IF(ISNULL(StartDate),'',Timestamp(Date#(StartDate, 'DD/MM/YYYY hh:mm:ss'), 'DD/MM/YYYY hh:mm:ss')) as StartDate