Last active
March 18, 2016 13:13
-
-
Save hasokeric/fe2f6695bef13eebf5da to your computer and use it in GitHub Desktop.
Epicor: Convert Seconds Since Midnight to an Actual Time
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 string ConvertSecondsToTime(int secondsSinceMidnight) | |
{ | |
// Initialize Variables | |
int hour = 0, minutes = 0, seconds = 0; | |
decimal hourSecondsLeftOver = 0; | |
// Get Hour | |
hour = (int) secondsSinceMidnight / 3600; | |
hourSecondsLeftOver = (decimal) secondsSinceMidnight - (hour * 3600); | |
// Get Minutes | |
minutes = (int) hourSecondsLeftOver / 60; | |
// Get Seconds | |
seconds = (int) hourSecondsLeftOver - (minutes * 60); | |
// Return Result | |
return String.Format("{0:00}:{1:00}:{2:00}", hour, minutes, seconds); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment