Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Not applicable

How to extract hour from 24 hour time?

Eg 1423

I want to extract 14 and convert it to 2pm?

Tags (2)
7 Replies

Re: How to extract hour from 24 hour time?

Hi,

one solution could be:

QlikCommunity_Thread_193319_Pic1.JPG

hope this helps

regards

Marco

Not applicable

Re: How to extract hour from 24 hour time?

hour.JPG

Thank for the code, now how do I group the hour together? eg all the 9pm into a single bar?

priyarane
Contributor III

Re: How to extract hour from 24 hour time?

it is working..greeat

effinty2112
Honored Contributor

Re: How to extract hour from 24 hour time?

Hi Wil,

Remember that dates are stored as a Dual values in QlikView. They are numbers with a text representation. Marco's advice showed how to set the text representation the way you wanted it but the number is not rounded to the hour. So when you later went to make a bar chart you find that because QlikView still stores the time with a precision of minutes you're getting the bar chart as shown.

Wrapping Text() around your time dimension in your chart should give the result your looking for.

You've asked another question here after Marco had answered. I suggest that it would be fair for you to mark this question as having been answered by Marco.

Re: How to extract hour from 24 hour time?

Hi,

maybe like this:

=Time(Time#(Left('1423',2),'hh'),'hTT')

or this

=Time(Floor(Time#('1423','hhmm'),'01:00'),'hTT')

hope this helps

regards

Marco

Not applicable

Re: How to extract hour from 24 hour time?

Thanks! It's working!

Re: How to extract hour from 24 hour time?

you're welcome

please close this thread if your question is answered.

thanks

regards

Marco

Community Browser