C# DateTime ToFileTimeUtc

Description

DateTime ToFileTimeUtc converts the value of the current DateTime object to a Windows file time.

Syntax

DateTime.ToFileTimeUtc has the following syntax.


public long ToFileTimeUtc()

Returns

DateTime.ToFileTimeUtc method returns The value of the current DateTime object expressed as a Windows file time.

Example

The following code shows how to use DateTime.ToFileTimeUtc method.


using System;// ww  w  .  j  a  v  a2s.c  o  m

public class Example
{
   public static void Main()
   {
      DateTime date1 = new DateTime(2010, 3, 14, 2, 30, 00);
      long ft = date1.ToFileTimeUtc();
      DateTime date2 = DateTime.FromFileTime(ft);
      Console.WriteLine("{0} -> {1}", date1, date2); 
   }
}

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