Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
how to extract only date from datetime in sql 2008
please specify any other method except convert
Posted

Have a look here

http://www.bennadel.com/blog/122-Getting-Only-the-Date-Part-of-a-Date-Time-Stamp-in-SQL-Server.htm[^]

e.g

SQL
SELECT 
    CAST( FLOOR( CAST( getDate() AS FLOAT ) ) AS DATETIME )
 
Share this answer
 
Comments
Espen Harlinn 14-Jan-11 5:53am    
5+ good answer, nice link :)
Dylan already given you Perfect answer you can also use given code to get Date from DateTime

select Dateadd(dd,0,datediff(dd,0,getdate()))


it works
try it..
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900