|
![]() |
Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming | |
Java Timestamp Help
|
||
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) |
|
Networking Nut
![]() |
The language I'm using in is Java.
I would like to get how many minutes have passed since a timestamp was saved (in a rounded integer preferrably). Assume I already have the timestamp saved. Thanks! Last edited by Lyoko : 07-06-08 at 05:33 PM |
|
|
|
|
|
#2 (permalink) | |||||||||||||
|
With great difficulty
![]() |
Assume start is the value returned from a previous call to System.currentTimeMillis()
__________________Code:
public int minutesElapsed(long start){
long diff = System.currentTimeMillis() - start;
return (int)((diff)/(1000*60));
}
Note that if you multiply by .001 before storing you lose the decimal places and are left with seconds rather than milliseconds
Last edited by rabidgnome229 : 07-05-08 at 11:27 PM |
|||||||||||||
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|