Forum Discussion
Anonymous
8 years agoNot applicable
Change datetime format to date in SQL
Hi, I was trying to change the datetime format to date in the SQL statement in order to lessen the M query due to connecting to a huge database. Here is my code: convert(date, createTime, 101), ...
- Anonymous8 years ago
The createtime column is in datetime format.
Only the cast(createtime as date) works for me. The result is in the format of datetime too.
Is that possible to direct convert it to date format without using query M?
DataAnalyst21
4 years agoNew Member
That's obvious and is clearly not the question.
You are aware that in M there's a data type Date that removes the Time component completely? So why when in SQL you explicitly CAST DateTime as DATE PowerQuery is not picking it up as Date data type but instead is treating it as DateTime with 00:00:00 in the time part? It looks ugly and is confusing.
nohowUp_fnDown
3 years agoAdvocate I
Any updates on this or do I have to explicitly FIX every date column in Power BI? It's a complete pain when you've already specified it as a DATE data type in Microsoft SQL Server.