Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x = ms / 1000
- seconds = x % 60
- x /= 60
- minutes = x % 60
- x /= 60
- hours = x % 24
- x /= 24
- days = x
- seconds=(A/1000)%60
- minutes=(A/(1000*60))%60
- hours=(A/(1000*60*60))%24
- int milliseconds = someNumber;
- int seconds = milliseconds / 1000;
- int minutes = seconds / 60;
- seconds %= 60;
- int hours = minutes / 60;
- minutes %= 60;
- int days = hours / 24;
- hours %= 24;
- Long serverUptimeSeconds =
- (System.currentTimeMillis() - SINCE_TIME_IN_MILLISECONDS) / 1000;
- String serverUptimeText =
- String.format("%d days %d hours %d minutes %d seconds",
- serverUptimeSeconds / 86400,
- ( serverUptimeSeconds % 86400) / 3600 ,
- ((serverUptimeSeconds % 86400) % 3600 ) / 60,
- ((serverUptimeSeconds % 86400) % 3600 ) % 60
- );
Add Comment
Please, Sign In to add comment