unix time in c# code example
Example 1: unix time c#
Int32 unixTimestamp = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
Example 2: get unix time in seconds C#
DateTimeOffset.UtcNow.ToUnixTimeSeconds()
Int32 unixTimestamp = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
DateTimeOffset.UtcNow.ToUnixTimeSeconds()