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: 
prees959
Creator II
Creator II

Convert hh:mm:ss to hh:mm

Hi All,

I'm importing numerous time fields from a qvd which are being imported as hh:mm:ss.

I only require hh:mm and I'm trying to use time(floor(MyTimeField,1/(24*60)),'hh:mm') to remove the 'ss' section of the time.


However, this is only working for some of the records.  I'm now getting a mixture of hh:mm:ss and hh:mm.......

Can anyone advise please?

Many thanks,

Phil

14 Replies
sunny_talwar

Would it be possible to share the script... don't need everything... just the structure and the time field references

prees959
Creator II
Creator II
Author

Hi,  Something very strange is happening...

I have the following two identical lines of code :

time(time#(left(Requested_Start_Time,2) & ':' & Mid(Requested_Start_Time,4, 2 ),'hh:mm'),'hh:mm') as req_min3,

time(time#(left(Requested_Start_Time,2) & ':' & Mid(Requested_Start_Time,4, 2 ),'hh:mm'),'hh:mm')   AS Requested_Start_Time,

But, the output is totally different.....when viewed in EasyQlik viewer,  req_min3 has the correct output of hh:mm for all data values but Requested_Start_Time  has mostly hh:mm:ss with some values converted to hh:mm

time_error.PNG

Hope you can help.......

Phil

sunny_talwar

Not sure I have any idea without taking a look... may be one of these guys can look

marcus_sommer

pcammaert

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Any chance of getting an example document with just the time field anomalies? We may be able to recreate your situation ourselves but that's not guaranteed.

marcus_sommer

Your code-snippet is from the qvw which reads the csv and creates the qvd or from the qvw which reads the qvd?

For a first check of the data I would use a listbox with the time-field and then adding some expression to them like:

text(Field)

num(Field)

len(Field)

just to find out if there isn't anything wrong with the data and formatting-issue is only an effect and not the cause.

- Marcus