c# convert long to datetime code example
Example 1: c# datetime to timestamp
DateTimeOffset.UtcNow.ToUnixTimeSeconds()
Example 2: c# convert long to int
// wraps around
int myIntValue = unchecked((int)myLongValue);
// throws OverflowException
Convert.ToInt32(myValue);