c# unix timespan code example Example: c# get unix timespan var unixTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();