在 SQL SELECT 语句中更改日期格式(DD/MM/YYYY)

2021-09-10 00:00:00 sql tsql sql-server

原始 SQL 语句是:

The Original SQL Statement is:

SELECT SA.[RequestStartDate] as 'Service Start Date', 
       SA.[RequestEndDate] as 'Service End Date', 
FROM
(......)SA
WHERE......

输出日期格式为 YYYY/MM/DD,但我希望输出日期格式为 DD/MM/YYYY.我如何修改此声明?

The output date format is YYYY/MM/DD, but I want the output date format is DD/MM/YYYY. How can I modify in this statement?

推荐答案

试试这个...

select CONVERT (varchar(10), getdate(), 103) AS [DD/MM/YYYY]

更多信息:http://www.sql-server-helper.com/tips/date-formats.aspx

相关文章