I have a table called Raw_Data and the data looks like:
ID Res_Date
1 2010-08-09 00:00:00.000
2 2010-07-09 00:00:00.000
3 2010-02-09 00:00:00.000
I am looking for output to be :
ID Res_Date
1 2010-09-08 00:00:00.000
2 2010-09-07 00:00:00.000
3 2010-09-02 00:00:00.000
I tried following query;
Select ID,convert(datetime,Res_date,121) from Raw_data
but the format doesn’t change. Can anyone help me.
You can try this if you want dashes in your results
If you want slashes:
Here are some resources on formatting datetime
http://www.mssqltips.com/sqlservertip/1145/date-and-time-conversions-using-sql-server/
http://anubhavg.wordpress.com/2009/06/11/how-to-format-datetime-date-in-sql-server-2005/