I am trying to update a date field in my table but would to convert the date format into dd/mm/yy.
i have tried this method but it is still showing like this yyyy-mm-dd
UPDATE MyTable
SET MyField = convert (varchar,GETDATE(), 101)
where ID = '221'
You shouldn’t consider formatting when inserting. Since the
MyFieldis of data typedatetimethen just update it withGETDATE()like so:Dates are not stored with a format.
And you should store date/datetime values into
dateordatetimedata types.Then, when selecting these date values, you can use the
CONVERTfunction as you did in your question to format the date. And you will find in this page all the codes and thier format. Choose what suits you. Something like:Demo