Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. public class Tra {
  2.  
  3. public static void main(String[] args) {
  4.  
  5.  
  6. long seconds = (System.currentTimeMillis()/100);
  7. long minutes = seconds / 60;
  8. long hours = minutes / 60;
  9. long days = hours / 24;
  10.  
  11.  
  12. long time = System.currentTimeMillis();
  13. long days1 = time / (1000 * 60 * 60 * 24);
  14. long rest = time % (1000 * 60 * 60 * 24);
  15.  
  16. long hours1 = rest / (1000 * 60 * 60);
  17. rest %= (1000 * 60 * 60);
  18.  
  19. long minutes1 = rest / (1000 * 60);
  20. rest %= (1000 * 60);
  21.  
  22. long seconds1 = rest / 1000;
  23.  
  24.  
  25. System.out.println(days1 + " : " + hours1 + " : " + minutes1 + " : " + seconds1);
  26.  
  27. System.out.print(days + ":");
  28. System.out.print(hours + ":");
  29. System.out.print(minutes+ ":");
  30. System.out.print(seconds);
  31.  
  32. // так як завдання не повністю зрозуміле, довелось його виконати в двох варіаціях :)
  33. }
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement