Hi,
I've already searched for this question, and tried the code in the answers given, but I still can't get it to work.
I'm trying to display the current date in the format dd/mm/yy, with no time.
Here is the code I've tried so far:
--set dateformat dmy DECLARE @today as date --set @today = CONVERT(date, getdate()) as [dd/mm/yy] set @today = CONVERT(VARCHAR(10), GETDATE(), 103) AS [DD/MM/YYYY]
print @today
The commented out lines are previous attempts. When I run the code as it is above, I get the following error message:
Incorrect syntax near the keyword 'AS'.
DECLARE @today as date set @today = CONVERT(date, getdate()) set dateformat dmyThe code above results in:
2012-06-06
but I need the format to be 06-06-2012.
Thanks
- Changed type aspNewbie1978 Wednesday, June 06, 2012 11:01 AM