C# DateTimeOffset FromFileTime

Description

DateTimeOffset FromFileTime converts the specified Windows file time to an equivalent local time.

Syntax

DateTimeOffset.FromFileTime has the following syntax.


public static DateTimeOffset FromFileTime(
  long fileTime
)

Parameters

DateTimeOffset.FromFileTime has the following parameters.

  • fileTime - A Windows file time, expressed in ticks.

Returns

DateTimeOffset.FromFileTime method returns An object that represents the date and time of fileTime with the offset set to the local time offset.

Example

The following example uses the DateTimeOffset.FromFileTime method.


using System;// w ww  . ja v  a2 s. com
using System.IO;
using System.Runtime.InteropServices;

public class FileTimes
{

   public static void Main()
   {
     Console.WriteLine(DateTimeOffset.FromFileTime(999999999999L).ToString());
   }
}

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