Datetime Functions Overview

Updated on

Explore Datetime Functions in Power Query M Language, essential for manipulating date and time values. This page provides a comprehensive list and descriptions of Datetime Functions available in the M Language.

Table of contents

Component Functions

FunctionDescription
DateTime.DateReturns the date component of the given date, datetime, or datetimezone value.
DateTime.TimeReturns the time part of the given datetime value.

Creation and Conversion Functions

FunctionDescription
#datetimeCreates a datetime value from numbers representing the year, month, day, hour, minute, and (fractional) second.
DateTime.FromCreates a datetime from the given value.
DateTime.FromFileTimeCreates a datetime from a 64 bits long number.
DateTime.FromTextCreates a datetimezone from local and universal datetime formats.
DateTime.ToRecordReturns a record containing the datetime value’s parts.
DateTime.ToTextReturns a textual representation of the datetime value.

Current Value Functions

FunctionDescription
DateTime.FixedLocalNowRetrieves the current date and time based on the local timezone.
DateTime.LocalNowReturns the current date and time in the local timezone.

Information Functions

FunctionDescription
DateTime.IsInCurrentHourIndicates whether this datetime occurs during the current hour.
DateTime.IsInCurrentMinuteIndicates whether this datetime occurs during the current minute.
DateTime.IsInCurrentSecondIndicates whether this datetime occurs during the current second.
DateTime.IsInNextHourIndicates whether this datetime occurs during the next hour
DateTime.IsInNextMinuteIndicates whether this datetime occurs during the next minute
DateTime.IsInNextNHoursIndicates whether this datetime occurs during the next number of hours
DateTime.IsInNextNMinutesIndicates whether this datetime occurs during the next number of minutes
DateTime.IsInNextNSecondsIndicates whether this datetime occurs during the next number of seconds
DateTime.IsInNextSecondIndicates whether this datetime occurs during the next second
DateTime.IsInPreviousHourIndicates whether this datetime occurs during the previous hour
DateTime.IsInPreviousMinuteIndicates whether this datetime occurs during the previous minute
DateTime.IsInPreviousNHoursIndicates whether this datetime occurs during the previous number of hours
DateTime.IsInPreviousNMinutesIndicates whether this datetime occurs during the previous number of minutes
DateTime.IsInPreviousNSecondsIndicates whether this datetime occurs during the previous number of seconds
DateTime.IsInPreviousSecondIndicates whether this datetime occurs during the previous second

Timezone Functions

FunctionDescription
DateTime.AddZoneAdds timezone information to the datetime value.

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

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