Click here to Skip to main content
15,894,410 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hey everyone,

I have a datetime column in my sql database table,how can i retrieve only date from that column and not time?....

Thanks
Amit
Posted

SQL
select convert(varchar,OrderDate,104) as OrderDate from tblOrder

It's running properly.
 
Share this answer
 
v2
A little google goes a long way ("t-sql get date from datetime") - I found at least three ways to do it, and that was at the first link returned by google. Here's one of them:

SQL
SELECT CONVERT(CHAR(10),GETDATE(),103)
 
Share this answer
 
Comments
AmitChoudhary10 2-Nov-10 8:09am    
did'nt get it,my column name is OrderDate and table is tblOrder.I tried this but its giving error--select convert(varchar,OrderDate,101) from tblOrder
Mohd Wasif 2-Nov-10 8:27am    
What kind of error it's giving.
SQL
SELECT CONVERT(VARCHAR(10),GETDATE(),111)


May this help you.
 
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