DateTime.FromFileTime

Updated on

DateTime.FromFileTime is a Power Query M function that creates a datetime value from the fileTime value and converts it to the local time zone.

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

Syntax

DateTime.FromFileTime( fileTime as nullable number ) as nullable datetime

Description

The DateTime.FromFileTime function converts a Windows file time value into a DateTime value. A Windows file time value counts the number of 100-nanosecond intervals since midnight on January 1, 1601 A.D., UTC. This function translates that file time into your local time zone.

Examples

Let’s convert a Windows file time value into a DateTime value. For example, converting 133879492529842245 into a DateTime value can be done as follows:

// Output: #datetime( 2025, 4, 1, 4, 47, 32.984 )
DateTime.FromFileTime( 133879492529842245 )

This function is particularly useful when dealing with timestamps from Windows file systems.

Other functions related to DateTime.FromFileTime are:

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/datetime-fromfiletime

2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy