Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

stabben23
Honored Contributor

Num to time

Hi,

I have a num value =2 this is really 00:00:02 on the clock. I also have 92433 which is 09:24:33

I want the field to be formated as a time value like hh:mm:ss. SQL code or in qlikview is OK.

Tags (2)
1 Solution

Accepted Solutions

Re: Re: Num to time

So you mean to say the formula i have given is not working?

Load

  TimeField,

  Time#(Left(Repeat('0',6-Len(TimeField))&TimeField,2) & ':' & Mid(Repeat('0',6-Len(TimeField))&TimeField,3,2)& ':' &Right(Repeat('0',6-Len(TimeField))&TimeField,2),'hh:mm:ss') as NewTimeField

Inline

[

  TimeField

  113

  1256

  211318

  144036

  2

  92433

];

Create a table box with TimeField and TimeFieldNew as your two field.... and let me know if you are still not getting the result..

11 Replies
MVP
MVP

Re: Num to time

Try like:

Time(Time#(092433, 'hhmmss')) as Time , and you can then replace this number by a field that holds the similar values.

Re: Num to time

Load

  TimeField,

  Time#(Left(Repeat('0',6-Len(TimeField))&TimeField,2) & ':' & Mid(Repeat('0',6-Len(TimeField))&TimeField,3,2)& ':' &Right(Repeat('0',6-Len(TimeField))&TimeField,2),'hh:mm:ss') as NewTimeField

Inline

[

  TimeField

  2

  10

  12

  434

  1123

  92433

];

Re: Num to time

Hi try below

=Time(Time#(092433, 'hhmmss'),'hh:mm:ss')

Regards

ASHFAQ

stabben23
Honored Contributor

Re: Num to time

Hi,

sorry but non of these works, I can tell that my TimeFormat is 'h:mm:ss TT'

Re: Num to time

Hi,

Try below

=Time(Time#(Field, 'h:mm:ss TT'),'hh:mm:ss')

Can you attach sample data here.

Regards

ASHFAQ

Re: Num to time

Provide few lines for that Field along with expected result..

stabben23
Honored Contributor

Re: Re: Num to time

Hi, Like this

113, 1256, 211318, 144036, 2

expected 00:01:13, 00:12:56, 21:13:18, 14:40:36, 00:00:02

Re: Re: Num to time

So you mean to say the formula i have given is not working?

Load

  TimeField,

  Time#(Left(Repeat('0',6-Len(TimeField))&TimeField,2) & ':' & Mid(Repeat('0',6-Len(TimeField))&TimeField,3,2)& ':' &Right(Repeat('0',6-Len(TimeField))&TimeField,2),'hh:mm:ss') as NewTimeField

Inline

[

  TimeField

  113

  1256

  211318

  144036

  2

  92433

];

Create a table box with TimeField and TimeFieldNew as your two field.... and let me know if you are still not getting the result..

stabben23
Honored Contributor

Re: Re: Num to time

Hi,

I'v must have forgott to changed all TimeField to my time field because it really work.

Thanks

Community Browser