I am struggling to convert a date to format ddmmyy
NOT ddmmyyyy
.
The convert
function allows all sorts of clever formatting but nothing close enough to fix using REPLACE
.
Any help would be appreciated.
dd/mm/yy is British\French standard, so try this:
SELECT REPLACE(CONVERT(CHAR(8), [MyDateTime], 3), '/', '')
SELECT REPLACE(CONVERT(VARCHAR(10), GETDATE(), 5),'-','')
format number 5 will do dd-mm-yy and then you can remove the -'s
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