Get the number of ticks of DateTimeOffset in Coordinated Universal Time (UTC) in CSharp
Description
The following code shows how to get the number of ticks of DateTimeOffset in Coordinated Universal Time (UTC).
Example
using System;//from w w w. ja v a2 s. c om
public class MainClass{
public static void Main(String[] argv){
DateTimeOffset localTime = DateTimeOffset.Now;
DateTimeOffset utcTime = DateTimeOffset.UtcNow;
Console.WriteLine("Local Time: {0}", localTime.UtcTicks);
Console.WriteLine("UTC: {0}", utcTime.UtcTicks);
}
}
The code above generates the following result.