sqlserver里如何将一个日期值格式化输出为YYYY年MM月DD日的格式

2024-12-22 21:58:01
推荐回答(5个)
回答1:

select cast(year(getdate()) as varchar(10)) + '年'
+ cast(month(getdate()) as varchar(10)) + '月'
+ cast(day(getdate()) as varchar(10)) + '日'

回答2:

select cast(year(workon) as varchar(10)) + '年' +
cast(month(workon) as varchar(10)) + '月' +
cast(day(workon) as varchar(10)) + '日'
from XXXXX(table名);

回答3:

select convert(varchar(10),workon,120) as workon from XXXX

回答4:

convert(vatchar(20),workon,23)

回答5:

SELECT convert(char(10),workon,120) as time