Last active
September 22, 2015 12:00
-
-
Save jayeshcp/fbe4985a1b34e96fd33c to your computer and use it in GitHub Desktop.
Convert seconds to Days, Hours, Mins, Secs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void ConvertSec2DaysHoursMinsSecs(int timeDiff) { | |
int days = (int) Math.floor(timeDiff / 86400); | |
int hour = (int) Math.floor((timeDiff % 86400) / 3600); | |
int min = (int) Math.floor((timeDiff % 3600) / 60); | |
int sec = (int) (timeDiff % 60); | |
System.out.println("(" + days + " " + hour + " " + min + " " + sec + ")"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment