Epoch Time Conversion
JSON Web Token (JWT) tokens use so-called Epoch or Unix time to represent date/times, which is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT).
In .NET, you can convert DateTimeOffset to Unix/Epoch time via the two methods of ToUnixTimeSeconds and
ToUnixTimeMilliseconds:
var seconds = DateTimeOffset.UtcNow.ToUnixTimeSeconds();var milliseconds = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();