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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Date/Time field

Hi guys,

Would anyone know how to strip out the time from a date/time field in a SQL table.

It is displayed like this in the table

2014-04-13 05:50:10.013

I would like to be able to analysis the data by time eg 05:50 from the example above.

Not sure if this is possible or not?

Thanks a lot

1 Solution

Accepted Solutions
Not applicable
Author

Try using the function extract(time from fieldname) under the sql statement.

Hope this helps

View solution in original post

10 Replies
MK_QSL
MVP
MVP

Considering your above fieldname from SQL table is TIME, you can achieve the same by preceding load in QlikView Script...

Load

     *,

     Time(Frac(Timestamp#(TIME,'YYYY-MM-DD hh:mm:ss.fff')),'hh:mm') as RequiredField;

TableName:

SQL SELECT

     TIME,

     SecondField,

     ThirdField......

.....

....

From .....

ecolomer
Master II
Master II

You can try:

Time(Date, 'hh:mm')

Anonymous
Not applicable
Author

time(date#('2014-04-13 05:50:10.013','YYYY-MM-DD hh:ss:sss'),'hh:mm')

ychaitanya
Creator III
Creator III

HI

You can try this as well

Mid(Timefield,12,5)

anbu1984
Master III
Master III

time(timestamp#('2014-04-13 05:50:10.013','YYYY-MM-DD hh:mm:ss.fff'),'hh:mm')

Not applicable
Author

Try using the function extract(time from fieldname) under the sql statement.

Hope this helps

Anonymous
Not applicable
Author

Thanks a lot for your help guys.  I used the SQL statement to get this information and this works great..

anbu1984
Master III
Master III

You can use extract to get year, month, day,hour, minute, second from timestamp in sql

Anonymous
Not applicable
Author

Thank you I will bear that in mind.

What i would like to do is a list box to basically choose the time of orders so between 10:00-11:00, 11:00-12:00, 12:00-13:00 etc.

Would this be achievable do you think?