February 20, 2013, 01:46 PM
reportmasterlvl3[SOLVED] calc date minus 1 month, like edate(MM/DD/YYYY,-1) in excel
Is there a simple way to calculate a date minus 1 month?
example:
01/01/2012 = 12/01/2011
03/01/2012 = 02/01/2012
09/05/2012 = 08/05/2012
Thanks!
This message has been edited. Last edited by: Kerry, February 20, 2013, 01:59 PM
Dan SatchellHave you tried function DATEADD?
DATEADD(date, 'component', increment);
DATEADD(date,'M',-1);
February 20, 2013, 02:21 PM
FrankDutchBut dateadd only will work if the date is in the database as a smartdate .
Else you need to convert it first.
February 20, 2013, 02:59 PM
reportmasterlvl3quote:
DATEADD(date,'M',-1);
Thanks Dan!
DATEADD(date,'M',-1) worked perfectly.
February 20, 2013, 03:40 PM
WazI would suggest familiarising yourself with the Fucntions Manual, its all in there, and you can get it as a PDF.