I have a
datetime column in SQL Server that gives me data like this
10/27/2010 12:57:49 pm and I want to query this column but just have SQL Server return the day month and year - eg.
2010 10 27 or something like that.
What are the functions I should be researching?
Should I be trying to convert to another date data type? Or simply convert it to a string?
This question is tagged with
~ Asked on 2012-01-17 20:18:45
Have a look at CONVERT. The 3rd parameter is the date time style you want to convert to.
SELECT CONVERT(VARCHAR(10), GETDATE(), 103) -- dd/MM/yyyy format
~ Answered on 2012-01-17 20:20:30
print cast(getdate() as date )
~ Answered on 2014-02-19 14:09:32