Reputation: 1058
How to convert from 02/03/2012
to 2/3/2012
format in SQL Server
Upvotes: 1
Views: 3189
Reputation: 230
This is going to get your exact results..
Declare @test datetime
Set @test = '02/03/2012'
Print Convert(VARCHAR(10) , @test,101 )
Print REPLACE(LEFT(Convert(VARCHAR(10) , @test,101 ),5),0,'') + RIGHT(Convert(VARCHAR(10) , @test,101),5)
RESULT:
02/03/2012
2/3/2012
Upvotes: 0
Reputation: 3494
And for your question answer
SELECT Convert(varchar, GETDATE(),1)
Upvotes: 1
Reputation: 445
if you're running SQL Server 2012, you can do this:
SELECT FORMAT ( @your_date_value, 'd', 'en-US' )
See http://msdn.microsoft.com/en-us/library/hh213505.aspx
Upvotes: 1
Reputation: 1601
http://www.sql-server-helper.com/tips/date-formats.aspx
I think, this will be helpful...
EDIT: (Same Question)
Upvotes: 2