Summary
In some cases, when downloading a CSV file containing a Date, the date may be malformed compared to what appears in the Dremio UI. You can use to_char() to reformat the date.
Reported Issue
When converting a date using to_date() on a table in Dremio, the date format will show up in the YYYY-MM-DD format in the Dremio UI, as shown below:
However, when you download as CSV, the results may look like this, which is not the format you would expect:
Date
2013-07-19T00:00
2013-07-16T00:00
2013-07-18T00:00
2013-07-18T00:00
If you download the same as a JSON file, you get the same format as appears in the UI.
Relevant Versions
All Dremio versions
Steps to Resolve
You can use to_char() instead of to_date() to format the Date the way you expect:
to_char(<date>,'YYYY-MM-DD')
This will allow you to download a CSV with your results in the intended format:
Date
2013-07-19
2013-07-16
2013-07-18
2013-07-18
Additional Resources
https://docs.dremio.com/cloud/reference/sql/sql-functions/functions/TO_DATE/
https://docs.dremio.com/cloud/reference/sql/sql-functions/functions/TO_CHAR/