11 Replies Latest reply: Aug 24, 2014 6:49 PM by Marco Wedel

# 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.

• ###### 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

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

• ###### 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..

• ###### 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?

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..

• ###### Re: Re: Num to time

Hi,

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

Thanks

• ###### Re: Num to time

Hi,

another solution:

```LOAD *,
Time(Mod(val,100)/86400+Mod(Div(val,100),100)/1440+Div(val,10000)/24) as Time
INLINE [
val
113
1256
211318
144036
2
];
```

hope this helps

regards

Marco

• ###### Re: Re: Num to time

... and one more:

Time(Time#(Num(val, '000000'), 'hhmmss'),'hh:mm:ss')

hope this helps

regards

Marco