Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: , +
i want to fetch date only from datetime in sql..
actually if i convert it as 'CONVERT(varchar(20),CreatedDate,105)' then its gives the actual format of conversion.but it show multiple date of same day on where clause due to datetime.i searched it at google but i didn't get any sufficient solution to do so..


if anyone have solution then plz help

thanks in advance
Posted
Comments
Tomas Takac 18-Dec-14 8:13am    
You lost me at the CONVERT. Anyway, try this: CAST(CreatedDate as Date)
itsathere 18-Dec-14 8:17am    
on your changes still table shows multiple date of different time interval
itsathere 18-Dec-14 8:30am    
btw thanks..its working

SQL
SELECT CONVERT(VARCHAR(25), GETDATE(), 1) as Date_Format
 
Share this answer
 
CONVERT(varchar(20),CreatedDate,121) format or 112 format for the date
 
Share this answer
 
try This!...

SQL
SELECT CONVERT(VARCHAR(12), GETDATE(), 103) as Date_Format
 
Share this answer
 
v2
SQL
SELECT CONVERT(varchar(10),GETDATE(),105)
 
Share this answer
 
SELECT CONVERT(DATE,GETDATE())
 
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