Int64 - FromFileTimeUtc
Converts the specified Windows file time to an equivalent UTC time.
public static void Main() { DateTime localDate = new DateTime(2010, 3, 14, 2, 30, 0, DateTimeKind.Local); Int64 fileTime = localDate.ToFileTimeUtc(); // C# Extension Method: Int64 - FromFileTimeUtc DateTime localDate2 = fileTime.FromFileTimeUtc(); Console.WriteLine("{0} = {1}: {2}", localDate, localDate2, localDate.Equals(localDate2)); }
View Source
using System; public static partial class Extensions { /// <summary> /// Converts the specified Windows file time to an equivalent UTC time. /// </summary> /// <param name="fileTime">A Windows file time expressed in ticks.</param> /// <returns> /// An object that represents the UTC time equivalent of the date and time represented by the parameter. /// </returns> public static DateTime FromFileTimeUtc(this Int64 fileTime) { return DateTime.FromFileTimeUtc(fileTime); } }