|
![]() |
Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming | |
Java Timestamp Help
|
||
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) |
|
Programmer
|
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 LyokoHaCk : 07-06-08 at 06:33 PM. |
|
|
|
|
|
#2 (permalink) | |||||||||||||
|
Apple Doesn't Love You
|
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-06-08 at 12:27 AM. |
|||||||||||||
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|