Created
November 7, 2012 19:55
Revisions
-
terkhorn renamed this gist
Nov 7, 2012 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
terkhorn created this gist
Nov 7, 2012 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ using System; namespace YourChoice { public static class TimeHelpers { public static DateTime FromEpochTime(this long unixTime) { var epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); return epoch.AddSeconds(unixTime); } public static long ToEpochTime(this DateTime date) { return (date.ToUniversalTime().Ticks - 621355968000000000) / 10000000; } } }