Click here to Skip to main content
15,880,651 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi guys, I was tried my requirement. But I want Date format like this : 25-Mar-2013.

Actually it was done by requirement using this :

Select REPLACE(CONVERT(VARCHAR,STARTDATE,106),' ','-')


But Here it can converting into string format.

Same format(25-Mar-2013) i will be convert into Date Format


Please any one help me...
Posted
Updated 24-Mar-13 23:54pm
v4

use
SQL
CAST( CONVERT(VARCHAR(10), startdate, 105) AS date) 
 
Share this answer
 
v3
Comments
CH Guravaiah 25-Mar-13 4:50am    
if it is executed , getting the like this : 2013-03-25 00:00:00.000

But i want 25-Mar-2013
Member 9762654 25-Mar-13 5:36am    
use date instead of datetime check my updated solution again
CH Guravaiah 25-Mar-13 5:51am    
Datetime also 2013-03-25 00:00:00.000
Member 9762654 25-Mar-13 7:23am    
have you solved?
Member 9762654 25-Mar-13 6:11am    
CAST( CONVERT(VARCHAR(10), startdate, 105) AS date) check solution
 
Share this answer
 
Comments
vinodkumarnie 25-Mar-13 5:21am    
didn't you got answer..?
CH Guravaiah 25-Mar-13 5:53am    
yes. please put the related answer. exactly same format like 25-Mar-2013 and it should be return the Date format only , not for Varchar like that.
vinodkumarnie 25-Mar-13 5:59am    
U can't expect spoon feeding yet.. Hope you got it..?

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