The Original SQL Statement is:
SELECT SA.[RequestStartDate] as 'Service Start Date',
SA.[RequestEndDate] as 'Service End Date',
FROM
(......)SA
WHERE......
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?
We change the date format from one format to another. For example - we have stored date in MM-DD-YYYY format in a variable, and we want to change it to DD-MM-YYYY format. We can achieve this conversion by using strtotime() and date() function.
Changed to:
SELECT FORMAT(SA.[RequestStartDate],'dd/MM/yyyy') as 'Service Start Date', SA.[RequestEndDate] as 'Service End Date', FROM (......)SA WHERE......
Have no idea which SQL engine you are using, for other SQL engine, CONVERT can be used in SELECT statement to change the format in the form you needed.
Try like this...
select CONVERT (varchar(10), getdate(), 103) AS [DD/MM/YYYY]
For more info : http://www.sql-server-helper.com/tips/date-formats.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With