将datetime列转换为特定的日期格式。 (T-SQL)

时间:2011-12-07 17:08:17

标签: sql tsql

我想要以下列格式输出datetime列(SellDate):

mm/dd/yyyy

,例如06/01/1998

我该怎么做?提前谢谢!

2 个答案:

答案 0 :(得分:10)

将其转换为具有相应conversion style;

的字符串
convert(varchar(10), thedatecol, 101)

答案 1 :(得分:0)

以DD / MM / YYYY获取日期 转换(varchar(10),TransactionDateTime,103) 输出: 2018年1月7日