Date.ToText

This function returns a text representation of a date. You can use an additional parameter called options to specify more properties if needed. The culture parameter is only used in older workflows. T...

Syntax

Date.ToText(date as nullable date, optional options as any, optional culture as nullable text) as nullable text

About

This function returns a text representation of a date. You can use an additional parameter called options to specify more properties if needed. The culture parameter is only used in older workflows. The options parameter can include the following fields: - Format: A text value that shows the desired format for the date. For more information, visit https://go.microsoft.com/fwlink/?linkid=2180104 and https://go.microsoft.com/fwlink/?linkid=2180105. If you do not include this field or set it to null, the date will be formatted using the default format defined by culture. - Culture: When Format is not null, Culture influences certain format specifications. For example, in "en-US", "MMM" corresponds to "Jan", "Feb", "Mar", etc., while in "ru-RU", "MMM" is "янв", "фев", "мар", etc. If Format is null, Culture determines the default format to use. If culture is null or not specified, Culture.Current is used. For backwards compatibility, options and culture can also be text values. This has the same effect as setting

Explanation

Example 1 Transform the date #date(2010, 12, 31) into text. The resulting output may vary based on the current cultural settings. Usage In Power Query, utilize the function MDate.ToText(#date(2010, 12, 31)). Output "12/31/2010" Example 2 Convert the date using a customized format and the German cultural settings. Usage In Power Query, use MDate.ToText(#date(2010, 12, 31), [Format="dd MMM yyyy", Culture="de-DE"]). Output "31 Dez 2010" Example 3 Determine the corresponding year in the Hijri calendar for January 1st, 2000 in the Gregorian calendar. Usage In Power Query, apply MDate.ToText(#date(2000, 1, 1), [Format="yyyy", Culture="ar-SA"]). Output "1420"