How to get current date in sql to MMMYY i.e. OCT13
select Convert(varchar(10),getdate(),6) this will generate 11 Oct 13
I need to get OCT13 .
Any help appreciated.
Front end application cannot do this formating. I am exporting the data from sql to another sql server Thanks
With the FORMAT Function its very easy to convert it to the right format: (for SQL Sever 2012)
SELECT FORMAT(GETDATE(), 'MMMyy')
SELECT REPLACE(RIGHT(CONVERT(VARCHAR(9), GETDATE(), 6), 6), ' ', '') AS [MMYY]
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