Skip to main content
Announcements
The way to achieve your own success is the willingness to help somebody else. Go for it!
cancel
Showing results for 
Search instead for 
Did you mean: 
un_check24
Contributor
Contributor

Grouping time to morning, noon and evening

Dear community,

I have a field called 'visit_last_action_time' which delivers me the exact user's time of last action, formatted as "hh:mm:ss" (e.g. "10:03:03")

Now I want to group these time stamps into Morning, Noon and Evening.


I tried the if function:

=if (visit_last_action_time > '12:00:00', 'Morning')

but it does not work properly, since the time stamps of different dates are not clustered together.

Can anyone help me?

Thank you so much in advance!

Best


Philipp

1 Solution

Accepted Solutions
el_aprendiz111
Specialist
Specialist

Hi

1 example

dual(timestamp(class(frac(visit_last_action_time ),480/(24*60)),'h:mm TT') & ' - ' & timestamp(class(frac(visit_last_action_time )+480/(24*60),480/(24*60)),'h:mm TT'), class(frac(visit_last_action_time ),480/(24*60))) as Betwen_HRS

View solution in original post

4 Replies
el_aprendiz111
Specialist
Specialist

Hi

1 example

dual(timestamp(class(frac(visit_last_action_time ),480/(24*60)),'h:mm TT') & ' - ' & timestamp(class(frac(visit_last_action_time )+480/(24*60),480/(24*60)),'h:mm TT'), class(frac(visit_last_action_time ),480/(24*60))) as Betwen_HRS

sunny_talwar

May be try this

If(Frac(visit_last_action_time) < MakeTime(12), 'Morning',

     If(Frac(visit_last_action_time) = MakeTime(12), 'Noon', 'Evening')) as Period

I am assuming that till 11:59 AM, it is morning and 12 pm is Noon and after that is evening..... change these according to your needs

un_check24
Contributor
Contributor
Author

Thanks so much to you guys, both worked and gives me some great new insights :-)!!

sunny_talwar

Awesome, please close this thread by marking correct and helpful responses.

Qlik Community Tip: Marking Replies as Correct or Helpful

Best,

Sunny