Date.FromText
This function converts a text representation into a date value. It can also accept an optional record parameter called options, which can specify additional properties. The record can include the foll...
This function converts a text representation into a date value. It can also accept an optional record parameter called options, which can specify additional properties. The record can include the following fields:
Format: A text value that specifies the format to be used for the conversion. For more information on different format values, visit the following links: [Link1] and [Link2]. If this field is omitted or set to null, the date will be parsed using a best effort method.
Culture: When the Format field is not null, the Culture field controls certain format specifiers. For instance, in "en-US", "MMM" represents months as "Jan", "Feb", "Mar", etc., while in "ru-RU", "MMM" would be "янв", "фев", "мар", etc. If Format is null, Culture will determine the default format to use. If Culture is null or not provided, the default Culture.Current setting will be used.
To accommodate legacy workflows, options can also be specified as a text value. This would have the same effect as options = [Format = null, Cultu
To change the text "2010-12-31" into a date value, you can use the Power Query MDate.FromText function. The code for this is MDate.FromText("2010-12-31") which will output #date(2010, 12, 31).
If you want to convert a date using a custom format and the German culture, you can use the following code: MDate.FromText("30 Dez 2010", [Format="dd MMM yyyy", Culture="de-DE"]). This will output #date(2010, 12, 30).
To find the date in the Gregorian calendar that corresponds to the beginning of 1400 in the Hijri calendar, you can use the Power Query function MDate.FromText("1400", [Format="yyyy", Culture="ar-SA"]). This will output #date(1979, 11, 20).