Created
February 20, 2018 20:00
-
-
Save mkropat/380404ccf8f4f280961d978a8bfb104a to your computer and use it in GitHub Desktop.
This file contains 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
<Query Kind="Program" /> | |
void Main() | |
{ | |
Format("00:00:00"); | |
Format("00:00:01"); | |
Format("23:59:00"); | |
Format("24:00:00"); | |
Format("24:00:01"); | |
Format("1.00:00:00"); | |
Format("1.00:00:01"); | |
} | |
void Format(string format) | |
{ | |
var t = TimeSpan.Parse(format); | |
Console.WriteLine($"\"{format}\" = Days: {t.Days}; Hours: {t.Hours}; Minutes: {t.Minutes}; Seconds: {t.Seconds}"); | |
} | |
// Outputs: | |
//"00:00:00" = Days: 0; Hours: 0; Minutes: 0; Seconds: 0 | |
//"00:00:01" = Days: 0; Hours: 0; Minutes: 0; Seconds: 1 | |
//"23:59:00" = Days: 0; Hours: 23; Minutes: 59; Seconds: 0 | |
//"24:00:00" = Days: 24; Hours: 0; Minutes: 0; Seconds: 0 | |
//"24:00:01" = Days: 24; Hours: 0; Minutes: 1; Seconds: 0 | |
//"1.00:00:00" = Days: 1; Hours: 0; Minutes: 0; Seconds: 0 | |
//"1.00:00:01" = Days: 1; Hours: 0; Minutes: 0; Seconds: 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment