Using SQL Server 2005
Table1
ID Date
001 01/12/2010
002 15/12/2010
....
DateFormat: dd/mm/yyyy
I want to change the dateformat like mm/dd/yy by using select query
Select id, date from table1
Expected Output
ID Date
001 12/01/2010
002 12/15/2010
....
How to make a query for the above format.
Need Query Help.
You can use convert
to specify a mm/dd format, like 101:
select CONVERT(varchar(30), YourColumn, 101)
If your table stores dates as a string, you'd have to convert the string to a date first, like:
select CONVERT(varchar(30), CONVERT(datetime, YourColumn), 101)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.