# Calculate percentage out of difference of values

I want to create a progressbar which progress (in %) is influenced by the time between a timestamp in the past.

Timestamp one would be 1382377800.

Timestamp two would be 1382377860

Those are 60 seconds. The first one should represent 0%, the other one 100%.

I know I have to divide it somehow and multiply it, but can't figure it out.

1382377830 should be 50% then :i

• Try $1382377800+0.5 (1382377860-1382377800)$. Adjust $0.5$ accordingly... – copper.hat Oct 21 '13 at 22:25
• I am sorry but the result is not what I wanted. I want to get a percentage like 0.5, not a real number. – user102389 Oct 21 '13 at 22:27
• Hmm, you need to do a little work here. Try $\frac{1382377830-1382377800}{1382377860-1382377800}$. – copper.hat Oct 21 '13 at 22:29
• Consider this as well. – abiessu Oct 21 '13 at 22:30

To find the percentage of 60 you've progressed past timestamp 1, simply subtract timestamp 1 from timestamp 2 to find the elapsed time and divide by 60. so: $$p = \frac{(T2 - T1)}{60}$$