Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

string to date & time

Hello,

I have 2 field names with date and time as strings in my basic data as follows: Date 20130405, meaning 2013-April-05 and time as 2015 meaning 8:15pm.

I need to convert these to actual dates(yyyy-mm-dd) in qlikview script and preferably combine them to one field.. How would I do this?

Help much appreciated.

Regards,

Kevin

6 Replies
hic
Former Employee
Former Employee

Timestamp(Timestamp#(Date & ' ' & Time,'YYYYMMDD hhmm'),'YYYY-MM-DD hh:mm') as MyField

See also http://community.qlik.com/blogs/qlikviewdesignblog/2012/06/07/get-the-dates-right

HIC

maxgro
MVP
MVP

in text box

=date(Date#('20130415', 'YYYYMMDD') + Time#('2015', 'hhmm'), 'yyyy-mm-dd hh:mm:ss')

in load

load

     ....,

     yourdatefield,

     yourtimefield,

     date(Date#(yourdatefield, 'YYYYMMDD') + Time#(yourtimefield, 'hhmm'), 'yyyy-mm-dd hh:mm:ss') as newfield

     ......

from

its_anandrjs
Champion III
Champion III

You can try with the below script also

LOAD *,

Date(Date#(Date,'YYYYMMDD'),'YYYY-MM-DD') as NewDate,

Time(Time#(Time,'hhmm'),'hh:mm') as NewTime,

Date(Date#(Date,'YYYYMMDD'),'YYYY-MM-DD')& ' ' & Time(Time#(Time,'hhmm'),'hh:mm') as NewDateTime,

    

LOAD * Inline

[

Date,Time

20130405,2015

];

=============

And on front end on any text box write script like

=Date(Date#(20130415,'YYYYMMDD'),'YYYY-MM-DD') &' '& Time(time#(2015,'hhmm'),'hh:mm')

Not applicable
Author

Thanks a bunch!

Not applicable
Author

thanks!

Not applicable
Author

thanks!