andrewalex.r (4/10/2013)
K, I need to change the format of the Date
You can change the format for displaying the date using the convert function. For example:
SELECT id,CONVERT(VARCHAR(10), DateValue, 101)AS 'MM/DD/4 digit year',CONVERT(VARCHAR(10), DateValue, 1) AS 'MM/DD 2 digit year'
,CONVERT(VARCHAR(10), DateValue, 4) AS 'German 2 digit year'
,CONVERT(VARCHAR(10), DateValue, 104) AS 'German 4 digit year' FROM #mytable
Results:
idMM/DD/4 digit yearMM/DD 2 digit yearGerman 2 digit yearGerman 4 digit year
410/17/2007 10/17/07 17.10.0717.10.2007
3710/17/2007 10/17/07 17.10.0717.10.2007
For a rather complete outline of what you can do can be found at: