Skip to content

Instantly share code, notes, and snippets.

@ilyaBrandon
Created February 17, 2016 20:32
Show Gist options
  • Save ilyaBrandon/4c6c299663962113d8c6 to your computer and use it in GitHub Desktop.
Save ilyaBrandon/4c6c299663962113d8c6 to your computer and use it in GitHub Desktop.
public class Documents {
public static void main(String[] args) {
// we must calculate how many D:H:M:S from 1 January 1970 to today
long time = System.currentTimeMillis()/1000;
int day = (int) time / (60 * 60 * 24);
time = time % (60 * 60 * 24);
int hour = (int) time / (60 * 60);
time = time % (60 * 60);
int min = (int) time / 60;
time = time % 60;
int sec = (int) time;
System.out.print(day + ":" + hour + ":"+ min + ":" + sec);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment