To Unix time
using System; internal static class Util { private const long ConversionParameter = 10000000L; private static readonly long TheEpoch = new DateTime(1970, 1, 1, 9, 0, 0, DateTimeKind.Local).Ticks / ConversionParameter; private const long RoundParameter = 18000000000L; private static readonly TimeSpan FrameSpan = new TimeSpan(0, 30, 0); public static long ToUnixTime(this DateTime time) { long Ticks = time.Ticks / ConversionParameter; Ticks -= TheEpoch; return Ticks; } }