I'm using the following query to get the maximum days in a month as a datetime.
Select DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,'2014-01-01')+1,0))
The query result is: 2014-01-31 23:59:59.000
How can I get the following result : 2014-01-31 00:00:00.000
Thanks,