C# DateTimeOffset UtcTicks
Description
DateTimeOffset UtcTicks
gets the number of ticks that
represents the date and time of the current DateTimeOffset object in Coordinated
Universal Time (UTC).
Syntax
DateTimeOffset.UtcTicks
has the following syntax.
public long UtcTicks { get; }
Example
using System;/*from www. java 2s .co m*/
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.