I have datetimes stored in a table in SQL Server 2005 in the format of:
2012-04-16 00:00:00.000
I need to get date in the format of 16-Apr-2012 00:00:00 in my query result.
What is the best method of doing this?
Select Convert(VarChar(20),[SomeDate],113)
113, is 24h format and includes millisecond, the varchar(20) chops them off.
For further reference one of my favourite MSDN pages T-SQL Convert DateTime To String
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With