How to flip month and day in a datetime?
date, sql, sql-server
Solution
DECLARE @date DATETIME
SET DATEFORMAT ydm
SET @date = '2012-12-01 12:33:00.0'
SELECT @date
`SET DATEFORMAT ydm` will give you the result in your required format.
Other Option
UPDATE Table_Name
SET COLUMN_NAME= convert(varchar(20), convert(Date, @date, 101)) + convert(varchar(30),convert(time, @date))
WHERE
OR
select convert(datetime, convert(varchar(100), @date), 20)
Problem
How can I flip "2012-12-01 12:33:00.0" to become "2012-01-12 12:33:00.0"? I had tried "select convert(varchar(50), convert(datetime, log_date, 103), 121)" and used both 101 and 103 and still not able to flip it. The database is MS SQL