Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

TIME#

Hi All

our DB stores the EDIT_TIME as a string like this 74533 for 07:45:33

How do I convert this to hh:mm

I have tried; Time(Time#(YN_EDIT_TIME, 'hhmmss'),'hh:mm') but its does not seem to work.

Tags (1)
10 Replies

Re: TIME#

Hi

Try like this

Time(Time#(YN_EDIT_TIME, 'hmmss'),'hh:mm:ss')

Not applicable

Re: TIME#

it seems to work to me

dvasseur
Contributor II

Re: TIME#

Hi, Try this:

Time(Time#(If(Len(YN_EDIT_TIME)=5, '0' & YN_EDIT_TIME, YN_EDIT_TIME), 'hhmmss')) AS YN_EDIT_TIME

But it won't work if 11435 is for 11:04:35

rustyfishbones
Honored Contributor II

Re: TIME#

Like Mayil said

2013-10-14_1324.png

Not applicable

Re: TIME#

Thanks

Yeah, 11435 = 01:45:35 and 111435 = 11:14:35

Not applicable

Re: TIME#

hi

try this

time(time#(fieldname,'hmmss'),'hh:mm')

or this

Date(Date#(fieldname,'hmmss'),'hh:mm')

thornofcrowns
Valued Contributor II

Re: TIME#

OP requires hh:mm:ss to hh:mm, I think.

Re: TIME#

You should  use

Time(Time#(YN_EDIT_TIME, 'hmmss'),'hh:mm:ss') //based on 74533

if your DB  stores 07:04:05 as 745 then You should use hms instead of hmmss(its fine only if it stores it as 70405)

dvasseur
Contributor II

Re: TIME#

If minutes and seconds always have 2 digits, it will be fine !

Community Browser