Reputation: 99
I use SQL Server and I need to display a datetime
data type in the following format:
dd/mm
day-month without the year, which is the most effective way?
Upvotes: 1
Views: 10423
Reputation: 3970
You'll find this site really helpful I think:
http://www.sql-server-helper.com/tips/date-formats.aspx
From that link, you can see this as a quick way to get DD/MM:
SELECT CONVERT(VARCHAR(5), GETDATE(), 3) AS [DD/MM]
Upvotes: 3
Reputation: 93704
Use 103
style in convert
function and remove the year
SELECT LEFT(CONVERT(VARCHAR(15), Getdate(), 103), 5) --11/03
Upvotes: 4