Solved

Name Previous 3 months

Posted on 2013-01-02
4
283 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 52

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

Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

628 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