Solved

Name Previous 3 months

Posted on 2013-01-02
4
276 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 48

Expert Comment

by:Rgonzo1971
Comment Utility
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
Comment Utility
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
Comment Utility
That was it. Many thanks
0
 
LVL 16

Expert Comment

by:Imran Javed Zia
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now