DateTimeZone.ToText

This function generates a textual representation of a given dateTimeZone. Additionally, an optional record parameter called options can be included to specify extra properties. The culture field is on...

Syntax

DateTimeZone.ToText(dateTimeZone as nullable datetimezone, optional options as any, optional culture as nullable text) as nullable text

About

This function generates a textual representation of a given dateTimeZone. Additionally, an optional record parameter called options can be included to specify extra properties. The culture field is only utilized for older processes. The record can include the following attributes: Format: A text value that indicates the desired format for the representation. For more detailed information, visit the following links: https://go.microsoft.com/fwlink/?linkid=2180104 and https://go.microsoft.com/fwlink/?linkid=2180105. If this field is omitted or set to null, the date will be formatted using the default defined by the Culture setting. Culture: When the Format attribute is provided, Culture influences certain format specifications. For instance, in "en-US", "MMM" represents "Jan", "Feb", "Mar", etc., while in "ru-RU", "MMM" is "янв", "фев", "мар", etc. If the Format attribute is null, Culture determines the default format to be used. If Culture is null or not specified, the default Culture.Current setting is us

Explanation

Example 1: Transform the #datetimezone(2010, 12, 31, 01, 30, 25, 2, 0) into a text value. The outcome may differ based on the current culture in use. Usage: In Power Query M language, execute MDateTimeZone.ToText(#datetimezone(2010, 12, 31, 01, 30, 25, 2, 0)) Output: "12/31/2010 1:30:25 AM +02:00" Example 2: Change the format to a personalized one and switch to German culture settings. Usage: In Power Query M language, apply MDateTimeZone.ToText(#datetimezone(2010, 12, 30, 2, 4, 50.36973, -8,0), [Format="dd MMM yyyy HH:mm:ss.ffffff zzz", Culture="de-DE"]) Output: "30 Dez 2010 02:04:50.369730 -08:00" Example 3: Switch to the ISO 8601 pattern when converting. Usage: In Power Query M language, utilize MDateTimeZone.ToText(#datetimezone(2000, 2, 8, 3, 45, 12, 2, 0), [Format="O", Culture="en-US"]) Output: "2000-02-08T03:45:12.0000000+02:00"