/// <summary> /// DateTime to Long /// </summary> /// <param name="dateTime">DateTime</param> /// <returns>Long</returns> public static long ToUnixTimestamp(this DateTime dateTime) { TimeSpan unixTimeSpan = (dateTime - new DateTime(1970, 1, 1, 0, 0, 0)); return (long) unixTimeSpan.TotalSeconds; }