Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I need 3 Variables, i have 2 working,
Which get me the Current Month/Year and the Previous Month/Year and outputs them in full Eg 'January 2012', 'April 2012' etc...
Let Var1 = date(today(),'MMMM') & ' ' & year(today());
Let Var2 = date(monthstart(today())-1,'MMMM') & ' ' & year(today());
Now, I need some help with the 3rd!
As today is May 2012, i need to out 2 months prior in this format 'March 2012'
Any help would be appreciated, thanks.
Date(MonthStart(AddMonths(Today(),-2)),'MMMM YYYY')
Hope this helps,
Jason
If you really want text values in the variables, then you should use
Let Var1 = Date(MonthStart(Today()),'MMMM YYYY');
Let Var2 = Date(MonthStart(AddMonths(Today(),-1)),'MMMM YYYY');
Let Var3 = Date(MonthStart(AddMonths(Today(),-2)),'MMMM YYYY');
But if you want to use these variables for numerical purposes, e.g. comparisons in where-clauses, then you should use
Let Var1 = Num(MonthStart(Today()));
Let Var2 = Num(MonthStart(AddMonths(Today(),-1)));
Let Var3 = Num(MonthStart(AddMonths(Today(),-2)));
HIC
Henric,
'You Da Man!'
Blockrocker.