fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. long[] testInputs = {10210608}; // Example inputs in seconds
  13.  
  14. for (long epochTimeSeconds : testInputs) {
  15. // Convert seconds into days, hours, minutes
  16. long days = epochTimeSeconds / (24 * 60 * 60);
  17. long remainingSecondsAfterDays = epochTimeSeconds % (24 * 60 * 60);
  18.  
  19. long hours = remainingSecondsAfterDays / (60 * 60);
  20. long remainingSecondsAfterHours = remainingSecondsAfterDays % (60 * 60);
  21.  
  22. long minutes = remainingSecondsAfterHours / 60;
  23.  
  24. // Print the result
  25. System.out.println(epochTimeSeconds + " seconds is equivalent to:");
  26. System.out.println(days + " days, " + hours + " hours, " + minutes + " minutes.");
  27. System.out.println(); // Add a blank line for readability
  28. }
  29. }
  30. }
Success #stdin #stdout 0.2s 57844KB
stdin
Standard input is empty
stdout
10210608 seconds is equivalent to:
118 days, 4 hours, 16 minutes.