Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
realpixel
Contributor III
Contributor III

Convert value as time

Hello,

I have a fiel named "HMHEURCR" that I want to convert as a time.

For example value 143953 must converted to HH:MM:SS

I try an expression something like that but is not works

if(Right([HMHEURCR],2) <> 00, Time(time#([HMHEURCR],'HHMMSS'),'HH:MM:SS')) as HEURE,

Someone have an idea?

1 Solution

Accepted Solutions
Jason_Michaelides
Luminary Alumni
Luminary Alumni

Why are you using the IF() statement first?  What difference does it make if SS = 00?

Time(time#([HMHEURCR],'HHMMSS'),'HH:MM:SS') as HEURE


looks like it should work. Or the hhmmss may be case-sensitive:


Time(time#([HMHEURCR],'hhmmss'),'hh:mm:ss') as HEURE


Hope this helps,


Jason

View solution in original post

5 Replies
Jason_Michaelides
Luminary Alumni
Luminary Alumni

Why are you using the IF() statement first?  What difference does it make if SS = 00?

Time(time#([HMHEURCR],'HHMMSS'),'HH:MM:SS') as HEURE


looks like it should work. Or the hhmmss may be case-sensitive:


Time(time#([HMHEURCR],'hhmmss'),'hh:mm:ss') as HEURE


Hope this helps,


Jason

Not applicable

Hi,

Check out the link below,

http://community.qlik.com/message/366746#366746

Hope it Helps You...

Regards,

Ravikant

Not applicable

hi

try this

date(date#('143953','HHMMSS'),'HH:MM:SS')

OR THIS ONE

Time(Time#('143953','HHMMSS'),'HH:MM:SS')

***************************************************

similarly for field

date(date#(fieldname,'HHMMSS'),'HH:MM:SS')

OR THIS ONE

Time(Time#(fieldname,'HHMMSS'),'HH:MM:SS')

Not applicable

If you just want to convert it into time then there is no need to use if condition, you can directly use:

=Time(time#(HMHEURCR,'hhmmss'),'hh:mm:ss') as HEURE

in your expression.

Otherwise, if you really want to compare then use this:

=if(Right([Date_Num],2) <> 00, Time(time#(Date_Num,'hhmmss'),'hh:mm:ss'))  as HEURE

Hope this helps!

Anonymous
Not applicable

hi ,

use

Time(time#([HMHEURCR],'HHMMSS'),'HH:MM:SS')) as HEURE


it will read current format and covert in traget format.