How can i change dateformat?Forexample:
2009-06-10 10:16:41.123
->2009-June2009-05-10 10:16:41.123
->2009-MayHow can i change dateformat?Forexample:
2009-06-10 10:16:41.123
->2009-June2009-05-10 10:16:41.123
->2009-MayTry this:
select cast(datepart(year, mydatecolumn) as char(4)) + '-'
+ datename(month, mydatecolumn)
from mytable
You should not change the date-format in your database. You should just make sure that , when displaying the date, you correctly format the date, so that you display them in the format that you want.
How to do that, is related to the language you use in your program. You can also output the date directly in the format you want using the method of ck.
To interpret input use SET DATEFORMAT
To cast to character, see the CONVERT styles.
To format output, use whatever your client environment uses to format output, SQL itself has no output but TDS and display is left to the client.