Page 1 of 1

balance time

Posted: 19 Dec 2018 16:27
by Rafi4
hi Martin and all
I have set a reminder for ten minutes. four minutes past. how can I get balance minutes of six minutes.

script:
global_10 = addMinutes(getDate(),10); current time is 10.00 a.m after 10.04 a.m I want to get balance minutes of 6.
how can I? and how can I set percentage to global_10?

thanks from record4

Re: balance time

Posted: 19 Dec 2018 16:55
by Desmanto
Just deduct the global_10 from current time.

Code: Select all

balance = global_10 - getDate();
You will get 360000 (360 seconds, or 6 minutes).

You can then convert it duration as pointed by anuraag in other thread.

Code: Select all

balance = getDurationString(balance);
Or

Code: Select all

balance = "{balance,dateformat,timezone,UTC,HH:mm:ss}"
If you need percentage, you have to save the starting point time when you add the minutes. If you have a fixed 10 minutes range, just simply divide that 6 minutes to 10 minutes. (360000 / 600000), then times 100% to get it percentage.