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

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

Creation and Conversion Functions

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

Current Value Functions

FunctionDescriptionInputOutput
DateTime.FixedLocalNowReturns the current date and time in the local timezoneDatetimeDatetime
DateTime.LocalNowReturns the current date and time in the local timezone.DatetimeDatetime

Information Functions

FunctionDescriptionInputOutput
DateTime.IsInCurrentHourIndicates whether this datetime occurs during the current hour.AnyLogical
DateTime.IsInCurrentMinuteIndicates whether this datetime occurs during the current minute.AnyLogical
DateTime.IsInCurrentSecondIndicates whether this datetime occurs during the current second.AnyLogical
DateTime.IsInNextHourIndicates whether this datetime occurs during the next hourAnyLogical
DateTime.IsInNextMinuteIndicates whether this datetime occurs during the next minuteAnyLogical
DateTime.IsInNextNHoursIndicates whether this datetime occurs during the next number of hoursAnyLogical
DateTime.IsInNextNMinutesIndicates whether this datetime occurs during the next number of minutesAnyLogical
DateTime.IsInNextNSecondsIndicates whether this datetime occurs during the next number of secondsAnyLogical
DateTime.IsInNextSecondIndicates whether this datetime occurs during the next secondAnyLogical
DateTime.IsInPreviousHourIndicates whether this datetime occurs during the previous hourAnyLogical
DateTime.IsInPreviousMinuteIndicates whether this datetime occurs during the previous minuteAnyLogical
DateTime.IsInPreviousNHoursIndicates whether this datetime occurs during the previous number of hoursAnyLogical
DateTime.IsInPreviousNMinutesIndicates whether this datetime occurs during the previous number of minutesAnyLogical
DateTime.IsInPreviousNSecondsIndicates whether this datetime occurs during the previous number of secondsAnyLogical
DateTime.IsInPreviousSecondIndicates whether this datetime occurs during the previous secondAnyLogical

Timezone Functions

FunctionDescriptionInputOutput
DateTime.AddZoneAdds timezone information to the datetime value.DatetimeDatetimezone

BI Gorilla Blog

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