Solved

Name Previous 3 months

Posted on 2013-01-02
4
279 Views
Last Modified: 2013-01-02
Hi All,

I was using the following to give me the months names of previous months.

<%=(MonthName((Month(Now())-2)))%>

However, this is not a good solution as now its Jan (1)

Is there a built in function I can use to display previous month etc?

Kind regards

A.

PS. This is in classic ASP
0
Comment
Question by:Abiel de Groot
4 Comments
 
LVL 49

Expert Comment

by:Rgonzo1971
ID: 38736323
Hi,

You could add 12 and use modulo

Not sure of it

=(MonthName((Month(Now())-2+12) mod 12))%

Regards
0
 
LVL 17

Accepted Solution

by:
Kent Dyer earned 500 total points
ID: 38736340
I think this is what you are looking for..

wscript.echo MonthName(Month(DateAdd("m",-2,Now())))

Open in new window


HTH,

Kent
0
 
LVL 5

Author Closing Comment

by:Abiel de Groot
ID: 38736359
That was it. Many thanks
0
 
LVL 16

Expert Comment

by:Imran Javed Zia
ID: 38736375
Hi,

If you want to get month name of any date, or previous month of given date then, Please try the following:
This Month <%=MonthName(Now().Month)%> <br />
	Previous Month <%=MonthName(Now().AddMonths(-1).Month)%> <br />
	Previous to Previous Month <%=MonthName(Now().AddMonths(-2).Month)%> <br />

Open in new window


Thanks
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question