Focal Point
[SOLVED] calc date minus 1 month, like edate(MM/DD/YYYY,-1) in excel

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/7957009826

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,


wFDS: 7.7.03, OS: Windows, Output: Mostly Excel
February 20, 2013, 01:59 PM
Dan Satchell
Have you tried function DATEADD?

DATEADD(date, 'component', increment);

DATEADD(date,'M',-1);



WebFOCUS 7.7.05
February 20, 2013, 02:21 PM
FrankDutch
But dateadd only will work if the date is in the database as a smartdate .
Else you need to convert it first.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

February 20, 2013, 02:59 PM
reportmasterlvl3
quote:
DATEADD(date,'M',-1);


Thanks Dan!

DATEADD(date,'M',-1) worked perfectly.


wFDS: 7.7.03, OS: Windows, Output: Mostly Excel
February 20, 2013, 03:40 PM
Waz
I would suggest familiarising yourself with the Fucntions Manual, its all in there, and you can get it as a PDF.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!