How to get the unix timestamp in C#

In order to convert a specific date and time 
to a Unix time value we will need to subtract the date below from the date we want to convert to Unix time.
How to convert an Unixtime to DateTime class and viceversa in C# Unix time is basically the number of 
seconds that have passed since 1/1/1970 00:00:00 (UTC).


public static double ConvertToUnixTimestamp(DateTime date)
            DateTime origin = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
            TimeSpan diff = date.ToUniversalTime() - origin;
            return Math.Floor(diff.TotalSeconds);