Updated on

DateTimeZone.FromFileTime is a Power Query M function that creates a datetimezone value from a Windows file time value and converts it to the local timezone. The function returns a datetimezone value representing the file time in the local timezone.

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365


DateTimeZone.FromFileTime( fileTime as nullable number ) as nullable datetimezone


The DateTimeZone.FromFileTime function allows you to convert a Windows file time value into a datetimezone value. This function is particularly useful when you’re dealing with file metadata or system logs that use the Windows file time format, and you need to convert these timestamps into a more human-readable format for analysis or reporting.

Windows file time is a timestamp format used by the Windows operating system. It represents the number of 100-nanosecond intervals that have elapsed since 12:00 midnight on January 1, 1601 A.D. (C.E.) Coordinated Universal Time (UTC). DateTimeZone.FromFileTime takes this numeric value and converts it into a datetimezone value, adjusting it to the local timezone of the system where the query is run.


Let’s explore some practical examples where the DateTimeZone.FromFileTime function can be beneficial.

Suppose you’re analyzing a system log that uses Windows file time for its timestamps. To make sense of these timestamps, you can use DateTimeZone.FromFileTime to convert them into datetimezone values. Here’s an example:

Convert 132174496000000000 into a datetimezone value.

// Output: #datetimezone( 2019, 5, 11, 5, 46, 40, 0, 0 )
DateTimeZone.FromFileTime( 132174496000000000)

This function call will convert the Windows file time value “132174496000000000” into a datetimezone value.

Other functions related to DateTimeZone.FromFileTime are:

BI Gorilla Youtube Channel

Contribute » | Contributors: Rick de Groot
Microsoft documentation: