Forum Discussion
M - Date Format YYYY-MM-DD in Query while sending request to an API
Hi Anonymous,
You can use this M code to get date formatted as "YYYY-MM-DD".
Date.ToText(DateTime.Date(DateTime.LocalNow()), "yyyy-MM-dd")
But, the result is recognized as string. If we change it to date type, it will be automatically formatted to "D/MM/YYYY". Based on my test, Power Query only supports date format with "/" as delimiter. If date values contain "-", it will be changed to string by default.
Regards,
Yuliana Gu
Thanks v-yulgu-msft yes I have tried this today, and as expected, API rejects it :(
sometimes you are just stuck .
- v-yulgu-msft9 years ago
Microsoft Employee
Hi Anonymous,
Unfortunately, Power BI doesn't support date format 'YYYY-MM-DD'. Would it be possible to change the API suppoted date formate to 'YYYY/MM/DD'?
Regards,
Yuliana Gu- Anonymous9 years agoNot applicable
I have tried but API rejects it as will only accept that one format and that too in .number format.
I would try to get in touch with the API technical team to see, if they can create some provisions. Not sure how hard would it be.