Forum Discussion

pkoppurapu's avatar
pkoppurapu
Frequent Visitor
3 years ago

Error: We cannot convert the value #datetime() to type Date..

Exception: We cannot convert the value #datetime(2023, 5, 18, 0, 0, 0) to type Date..
when trying to convert or pass a date parameter into a query in power query mode. 
conversation syntax:

Date_text = Date.ToText(Date_value)
Date_value is of date data type. I've also tried using

  • Date_text = Date.ToText(Date_value, "mm/dd/yyyy")

  • Date_text = Date.ToText(Date_value, #duration(1, 0, 0, 0))

I am using direct query mode. 

1 Reply

  • ppm1's avatar
    ppm1
    Solution Sage

    Try Date.ToText(Date.From(Date_value), "MM/dd/yyyy" ) instead

     

    Pat