Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to extract hour from 24 hour time?

Eg 1423

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

7 Replies
MarcoWedel

Hi,

one solution could be:

QlikCommunity_Thread_193319_Pic1.JPG

hope this helps

regards

Marco

Not applicable
Author

hour.JPG

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

priyarane
Specialist
Specialist

it is working..greeat

effinty2112
Master
Master

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.

MarcoWedel

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
Author

Thanks! It's working!

MarcoWedel

you're welcome

please close this thread if your question is answered.

thanks

regards

Marco