Last active
April 9, 2020 12:37
-
-
Save ashour/31c404ecbe6724c04bf5b744ede3c3d3 to your computer and use it in GitHub Desktop.
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
using System; | |
class MainClass | |
{ | |
public static void Main (string[] args) | |
{ | |
var dateTime1 = new DateTime(1970, 1, 1, 0, 0, 0); | |
var dateTime2 = new DateTime(2020, 4, 1, 13, 30, 22, 500); | |
TimeSpan span = dateTime2 - dateTime1; | |
Console.WriteLine(span.ToString()); | |
// => 18353.13:30:22.5000000 | |
Console.WriteLine(span.ToString(@"hh\:mm\:ss")); | |
// => 13:30:22 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment