0

I've a problem on how to calculate the percentage based on:

  • Balance ( ex: 5.22 ) ( Integer ) ( How much money the user has put into this tasks )
  • Task Created on ( Milliseconds ) ( ex 1604919015906 )
  • Task deadline ( Milliseconds ) ( ex 1612047600000 )

I would like to get the percentage of this operation but I don't know how, any help?

Thanks in advance

user3880197
  • 21
  • 1
  • 1
  • 5
  • 3
    Balance in what? Seconds, Minutes? Parsec? – mplungjan Nov 09 '20 at 11:53
  • What does "balance" mean? – Stef Nov 09 '20 at 11:57
  • If you know that the task started at the same time it was created, and that it will end exactly at its deadline, then you could get a percentage as `(current_time - created_on) / (deadline - created_on)`. But since those are not the usual meaning of "task created" and "deadline", I don't think this applies here. – Stef Nov 09 '20 at 11:59
  • Balance is an Integer, basically it's the amount of money the user has inserted into this task. – user3880197 Nov 09 '20 at 12:03
  • Does this answer your question? [How to make a progress bar](https://stackoverflow.com/questions/3951903/how-to-make-a-progress-bar) – syarul Nov 09 '20 at 12:12

0 Answers0