Forum Discussion
Converting specific text to date in PowerQuery
- 9 years ago
Hi jrduboue,
You can use Date.FromText to achieve this requirement. It returns a Date value from a set of date formats and culture value, following ISO 8601 format standard.
Date.FromText(date as nullable text, optional culture as nullable text) as nullable dateSupported formats
-
yyyy-MM-dd
-
YYYYMMDD
-
M/d/yyyy
Reference
https://msdn.microsoft.com/en-us/library/mt260703.aspxRegards,
Charlie Liao
-
Hi jrduboue,
You can use Date.FromText to achieve this requirement. It returns a Date value from a set of date formats and culture value, following ISO 8601 format standard.
Date.FromText(date as nullable text, optional culture as nullable text) as nullable date
Supported formats
-
yyyy-MM-dd
-
YYYYMMDD
-
M/d/yyyy
Reference
https://msdn.microsoft.com/en-us/library/mt260703.aspx
Regards,
Charlie Liao
- edhans7 years agoCommunity Champion
Supported formatsyyyy-MM-dd
YYYYMMDD
M/d/yyyy
FWIW, it also supports "MMM DD YYYY" and appears to correctly convert the DD to a valid day whether it is two or one digits, i.e., "02" or " 2"
I don't know the full support for Date.FromText() conversion, but add this one to the list.
- Anonymous4 years agoNot applicable
not very useful. Our date format may vary such as: yymmdd, yyyymmmdd, ddmmmyy, ddmmyyyy,.... And we would like to get dates from our origin column in a specified format. Is there kind of function like: DateFromString(DateColumn, "yymmdd"). We can easily do this in other languages.