I got function which is converting UNIX time to DaTime which is working great anyhow now I need function to convert from DateTime to UNIX timestamp but something is wrong with this because when I am passing DateTime somehow the last 3 digits are not shown for instance I have this timestamp: "1300124700345" which is equal to: 14.03.2011 5:45 PM. When i pass that to my function I am retrieving: "1300124700" - 3 last digits dissaperd.
static readonly DateTime UnixEpoch =
new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
public static long ToUnixTime(DateTime date)
{
return Convert.ToInt64((date - UnixEpoch).TotalSeconds);
}