SQL statement to get selected date - 1 day

Hello,
I have a Sybase DB and I have a Query that has the following:
DATEFORMAT(CALENDAR_DATE, 'MM/DD/YYYY') AS CALENDAR_DATE_STR

The user will input a date at a command prompt like
01/01/2011 or 07/04/2011

What I need is to change the query so that it will actually select the day before whatever was input.
So if a user puts in
01/01/2011
The query will Select
12/31/2010

Or
07/04/2011
will get
07/03/2011

Thanks
Mark HarrisAsked:
Who is Participating?
 
wilcoxonCommented:
You just need to use DATEADD:

DATEFORMAT(DATEADD(dd, -1, CALENDAR_DATE), 'MM/DD/YYYY') AS CALENDAR_DATE_STR
0
 
sventhanCommented:
try this...

dateadd(d,-1, yourdate)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.