Change Date Format(DD/MM/YYYY) in SQL SELECT Statement

前端 未结 5 1083
挽巷
挽巷 2021-02-08 08:28

The Original SQL Statement is:

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


        
5条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-08 09:08

    Try:

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

    Or:

    SELECT format(SA.[RequestStartDate], 'dd/MM/yyyy') as 'Service Start Date', 
           format(SA.[RequestEndDate], 'dd/MM/yyyy') as 'Service End Date', 
    FROM
    (......)SA
    WHERE......
    

提交回复
热议问题