Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
sum25041994
Partner - Contributor III
Partner - Contributor III

Add Hour and minutes

Hi,

How to add Hours and minutes and display total minutes in a listbox:

ex: 02:30:00 should be 150 minutes

     05:30:00 should be 330 minutes

     08:00:00 should be 480 minutes.

Regards,

Sumit

1 Solution

Accepted Solutions
Anonymous
Not applicable

Hi Sumit,

I just put the condition of 12 hours if you dnt need it ,

=Minute('5:30')+hour('5:30')*60)


Just apply this


Thanks

Paridhi

View solution in original post

14 Replies
Anil_Babu_Samineni

May be this in script

Interval(Time#('02:30:00','hh:mm:ss'),'mm')

And change FieldName instead of static in script and then call that attribute

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anil_Babu_Samineni

For you

LOAD Hrmnts, Interval(Time#(Hrmnts,'hh:mm:ss'),'mm') as Hours Inline [

Hrmnts

02:30:00

05:30:00

08:00:00

];

Output this?

Capture.PNG

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sum25041994
Partner - Contributor III
Partner - Contributor III
Author

Hi Anil,

Thanks for the help. But i have a lot of time field, is their any shortcut method in script side that help me.

Regards,

Sumit

Anil_Babu_Samineni

Have you seen my second reply, that is the best way and easy

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
rahulpawarb
Specialist III
Specialist III

Hello Sumit,

Trust that you are doing good!

Please refer given sample script:

Data:

LOAD *,

     (Hour(Time#(T_Time, 'hh:mm:ss TT')) * 60)

     + Minute(Time#(T_Time, 'hh:mm:ss TT')) AS T_NewTime;

LOAD * INLINE [

T_Time

02:30:00 AM

05:30:00 PM

08:00:00 AM

12:45:00 AM

12:45:00 PM

];

Also refer the sample application attached herewith.

Regards!

Rahul

Anonymous
Not applicable

Hi ,

This would help in frontend-

if((Minute('Timefield')+hour('Timefield')*60)>=720,0,Minute('Timefield')+hour('Timefield')*60)


Example

=if((Minute('5:30')+hour('5:30')*60)>=720,0,Minute('5:30')+hour('5:30')*60)

330 min

Thanks

Paridhi

sum25041994
Partner - Contributor III
Partner - Contributor III
Author

Hi Paridhi,

Thanks for the reply, it's working, but total minutes which is greater then 720 is showing 0.

Need your help on this.

Regards,

Sumit

sum25041994
Partner - Contributor III
Partner - Contributor III
Author

Hi Rahul,

Thanks for the response, it's working , but can i know what's the requirement of T_time inside load table

  1. LOAD * INLINE [ 
  2. T_Time 
  3. 02:30:00 AM
  4. 05:30:00 PM 

it's creating an extra irrelevant value in my listbox. if i am removing that one in script, it's showing error.

Need your help on this

Regards,

Sumit

Anonymous
Not applicable

Hi Sumit,

I just put the condition of 12 hours if you dnt need it ,

=Minute('5:30')+hour('5:30')*60)


Just apply this


Thanks

Paridhi