Looking for good FILETIME converter
-
05-09-2019 - |
Question
In question Looking for Good CTIME/Unixtime converter I asked for a good web based CTIME (Seconds since Jan 1, 1970) time converter. (Usually a 32 bit signed integer).
I needed a tool where I could enter a date, and get the CTIME equivalent. I was able to find one, once I realized that Unixtime is the other name for the format. Google was my friend once I got there.
Now how about a FILETIME converter, which is more commonly used as 64 bit signed integer, representing 100 nanosecond units since Jan 1, 1601. (What Active Directory uses internally for time storage).
Probably there is some better keyword to search on that would find it for me. I have a tool that will show me the current time in FILETIME, and I can do the math elsewhere by hand, but not quite what I am looking from ease of use approach.
I have a function that can use it in code, but not a wrapper to make easily usable in a fast format. Java's time formatter supports it, but I again am looking for a nicely wrapped version of that.
Solution
This tool will convert all time types online.
OTHER TIPS
In Windows, the base time is 1/1/1601. The FileTime is also recorded using 100 Nanoseconds as the measure. Using VBA this will get you within a few seconds either way.
(The -4 is your current UTC Offset) EST is usually -5 but since our governments can't get together and standardize the DST switchovers or get rid of DST altogether, you'll have to change this to your time zone.
The 600000000 is converting 100 nanoseconds to minutes to avoid overflows.
Also, recognize that this is VBA, so pass your Double value in notation format.
Public Function ConvertFileTime(ByVal d As Double) As Date
ConvertFileTime = DateAdd("n", (d / 600000000) + (60 * -4), #1/1/1601#)
End Function
Example:
ConvertFileTime( 1.2944684916706E+17 )
This should return March 15, 2011 1:48 PM
Windows has a built-in command line tool that will convert a Windows FILETIME
into a human readable format (see Windows Time Service Tools).
Issuing the following command:
w32tm.exe /ntte 132015260350000000
produces this output:
152795 10:33:55.0000000 - 05.05.2019 12:33:55