datetime to timespan c# code example
Example 1: c# datetime to timestamp
DateTimeOffset.UtcNow.ToUnixTimeSeconds()
Example 2: c# convert datetime to timespan
Add .TimeofDay to the datetime value to make it of type TimeSpan
DateTime.TimeOfDay
DateTimeOffset.UtcNow.ToUnixTimeSeconds()
Add .TimeofDay to the datetime value to make it of type TimeSpan
DateTime.TimeOfDay