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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Problem loading date format correctly in script

I have a database table with the following format 'YYMMDD_HHMMSS' (as an example 111130_085114).

So my problem is to get qlikview to load this correctly in the script as a date and time format.

Anybody have a suggestion to solve this probably easy problem?

Labels (1)
5 Replies
Not applicable
Author

Try with this:

=date(date#(left('111130_085114', 6) , 'YYMMDD') + Time#(right('111130_085114', 6), 'hhmmss'), 'DD/MM/YYYY hh:mm:ss TT')

Replace '111130_085114' to a date field.

Regards,

Ricardo

manideep78
Partner - Specialist
Partner - Specialist

Try this

Date(Date#(Field_Name,'YYMMDD_hhmmss'),'DD-MM-YYYY hh:mm:ss') as Field_Name

rustyfishbones
Master II
Master II

Hi Try this,

For your 'YYMMDD_HHMMSS' I called that field DateTime and I used the following in the Script

I used the below code to extract the Date

DATE(SUBFIELD(DateTime,'_',1),'DD/MM/YYYY') as Date,

And I used the below to extract the Time

TIME(SUBFIELD(DateTime,'_',2),'HH:MM:SS') as Time

I hope this works for you

Regards

Rusty!

MayilVahanan
MVP
MVP

Hi

Try like this

Load date(dateformat) as Dateformat,Hour(dateformat) As Hour, Timestamp(dateformat,'hh mm ss') as time;

Load Date(date#('111130_085114','YYMMDD_hhmmss'),'DD-MM-YYYY hh:mm:ss') as dateformat AutoGenerate 1;

instead of 111130_085114 give ur field name;

hope it helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
Anonymous
Not applicable
Author

Hi Ricardo,

I tried your solution first in my script where I load my Sql data but realised that was not supposed to be here. Instead I created a List box and chose expresion as Field and edited as you suggested:

=date(date#(Left(line_id,6), 'YYMMDD') + Time#(right(line_id, 6), 'hhmmss'), 'DD.MM.YYYY hh:mm:ss')

And this work fine...

111130_083241        looks like     30.11.2011 08:32:41

I would like to do the convertion in the script as possible (don't know if it is possible loading data from a sql source) but this will do for now.

Thanks