Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

juan_escobar
Contributor

Re: Clock

Ok, I've done that and works great.

Now I want to transform an time data that's given as a decimal, how can I transform it from the script into a time format.

i.e:

Time from DB          Desired Data

9.00                        9:00

10.35                      10:35

14.10                       2:35 pm

P.S: when I transform the data I'm losing the 0 at the right.

Thank you.

MVP
MVP

Re: Clock

Try using

LOAD

...

time(time#(TIMEFROMDBFIELD,'hh.mm'),'hh:mm TT') as NEWTIMEFIELD

...

FROM ...

time#() will parse the data in as time type, time() will format it (again, check out format codes).

Hope this helps,

Stefan

P.S: What do you mean with "when I transform.. " above, could you post your expression?

Highlighted
juan_escobar
Contributor

Re: Clock

What I mean is that when I'm loading the data, its format comes like I wrote (1.42... 14.35... 6.00).

I've done that that you suggested and it went right. Now all the hours that are o'clock... like 6.00, the script erase the zeros affecting the format transformation.

Here is the load and an image of the result

A01:

LOAD

     tradoc,

     trahoi,

     Time(Time#(trahoi,'hh.mm'),'hh:mm TT') as trahoi1

FROM INMTRA_EXT_Copia.qvd (qvd);img.png

MVP
MVP

Re: Clock

Please try to format the read in numbers with fixed number of decimal places:

time(time#(num(TIMEFROMDBFIELD,'00.00'),'hh.mm'),'hh:mm TT') as NEWTIMEFIELD

juan_escobar
Contributor

Re: Clock

Thank you very much!!!

That worked perfect!

Community Browser