Here is What I have So Far
declare @Today smalldatetime
Set @Today = GETDATE()
select @Today
YIELDS
2011-03-10 13:46:00
What I need IS:
2011-03-09
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Try this:
GETDATE()returns the current date/time.DATEADD(dd, -1, GETDATE())substracts one day from the current date/time.CONVERT(VARCHAR, @DATE, 102)converts the date to ANSI formatyyyy.mm.ddand the REPLACE will replace the periods in the predefined format with hyphens as per your example.