# QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Today
cancel
Showing results for
Did you mean:
Highlighted
Partner

## Calculating time in script

Hi All,

I'm having a problem with calculating time.

In our planning-tooldatabase I have 2 time fields. (Planned time and the time spend)

Those are numeric for example if you get 16 hours in the database we zee 1600, if you get 2h and a half you se 230 in the database.

I can create a timefield in the script by using those 2

Interval((left(num(PlannedTime,'0000'),2) * 60 + Mid(num(PlannedTime,'0000'),3,2))/24/60,'hh:mm') as PlannedTimehhmm,
Time((left(num(PlannedTime,'0000'),2) * 60 + Mid(num(PlannedTime,'0000'),3,2))/24/60,'hh:mm') as PlannedTimeTijdhhmmTime

And the same for the SpendTime.

But how can I subtract those fields so I get the time that is available for this order?

Regards,

Kris

Labels (2)

• ### time difference

1 Solution

Accepted Solutions
Highlighted
MVP

## Re: Calculating time in script

Well, try this:

=interval(PlannedTimehhmm-Sum(Spendtime.URSpendTimehhmm), 'hh:mm')

5 Replies
Highlighted
MVP

## Re: Calculating time in script

Could you provide a sample data and expected output for that?

Highlighted
Partner

## Re: Calculating time in script

Hi,

attached you can find an example.

Hope this is enough.

Highlighted
MVP

## Re: Calculating time in script

Sorry, I am lost in your sample. Could you tell me what is expected output for two values you mentioned in op, 1600  (16 hours) and 230( 2 hours 30 mins)? 13 hours 30 mins right.

You could try like:

=interval(Time#(1600, 'hhmm')-Time#(230, 'hmm'), 'hh:mm')

Highlighted
Partner

## Re: Calculating time in script

In this example the planned time is 8 h ( 08:00)

and the person has spend once 20 min and once 30 min -> together 00:50

So the value I would like to see as difference is 07:10

Highlighted
MVP

## Re: Calculating time in script

Well, try this:

=interval(PlannedTimehhmm-Sum(Spendtime.URSpendTimehhmm), 'hh:mm')