Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
pkosiorek
Contributor II
Contributor II

Change number to time

Hello everyone,

I have question about Qlik Sense and conversion number (probably int) to time.

Our system ERP shows time as number (for example 742, 1840, 2130 where it is 7:42, 18:40, 21:30).

Unfortunately there is no dependence here because time 00:00 shows as 0 and 00:25 shows as 25.

I would like to write it more readable for report users in the form of time not number.

Can qlik allow such atypical conversions? Is there anyone who will help to the new user ?

BR,
Patryk

P.
1 Solution

Accepted Solutions
Anonymous
Not applicable

Maybe something like this :


time(time#(text(num(742, '0000')),'hhmm'),'hh:mm')

Seem to also work for the other exmples you gave


time(time#(text(num(1840 , '0000')),'hhmm'),'hh:mm')

time(time#(text(num(2130, '0000')),'hhmm'),'hh:mm')

time(time#(text(num(0, '0000')),'hhmm'),'hh:mm')

time(time#(text(num(25, '0000')),'hhmm'),'hh:mm')



View solution in original post

4 Replies
Anonymous
Not applicable

Maybe something like this :


time(time#(text(num(742, '0000')),'hhmm'),'hh:mm')

Seem to also work for the other exmples you gave


time(time#(text(num(1840 , '0000')),'hhmm'),'hh:mm')

time(time#(text(num(2130, '0000')),'hhmm'),'hh:mm')

time(time#(text(num(0, '0000')),'hhmm'),'hh:mm')

time(time#(text(num(25, '0000')),'hhmm'),'hh:mm')



pkosiorek
Contributor II
Contributor II
Author

Dear Bill,

It works as I wanted !

I adjusted your code to a specific field : time(time#(text(num("my_field", '0000')),'hhmm'),'hh:mm')

Thanks for help !

BR,
Patryk

P.
Anonymous
Not applicable

No worries, glad you are sorted and on the road.

pandiarajan
Creator
Creator

Hi Bill,

The above you mentioned Script is working in Text object for me. but it is not working in the load script. I would like to know if I missed anything or it is not possible in the Load script

Thanks