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.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version