Need a new web host or having a problem with a script? Tips and advice on the best way to design, build and maintain your most valuable asset - your website!

html code to display last month on page

simoni
Posts: 6
Joined: 23 Nov 08
Trust:

html code to display last month on page

Hi there,

I am trying to find a html code which allows me to have the month and year displayed for the previous month.

i.e. Actual month = August 2009
displayed month = July 2009

Actual Month January 2010
Displayed month = December 2009

Is it possible to do it with HTML?
Are there any wordpress plugins which would do this?

Look forward to your answers.....

Thanks

Simon
  • 1
www.beyondfirstclass.co.nz - Providing Exceptional Consultancy Services for Exceptional People
 
Moderator
wollowra
Posts: 1283
Joined: 14 Mar 08
Trust:
ok, I can not vouch for any of these so make surew you scan the file etc...
I take no responsibility...lol
I just searched on google.
You may also want to ask someone on the wordpress forums.

http://www.sourcecodeonline.com/details ... in_c_.html

or

[Link no longer available]

Regards
Troy
  • 1
Enjoy the little things, for one day you may look back and realize
they were the big things.

-- Robert Brault
 
PremiumMember
gradyp
Posts: 1062
Joined: 28 Jun 09
Trust:
Simon,

I don't think there's a way to do it with "standardized" HTML (ie code that should work across all browsers and platforms). Proper HTML should only mark up the code. It may be possible with a script of some kind, though where you would find one, I don't know offhand. If you can't find it with a plug-in, you might search for a script.

Grady
  • 1
Have questions about creating images? Want an image created for you? Check out my site at www.GradyPruitt.com/welcome-affilorama-friends
 
Site Admin
paulus
Posts: 28
Joined: 06 Apr 08
Trust:
Hi Simon,
to do what your asking you'll be needing to use JavaScript - you can copy and paste the script I've supplied below to do what your after. This will work in pretty much all cases except when a user has JavaScript disabled in their browser.

Just paste this into the the top of your page somewhere.
Code: Select all
<script type="text/javascript">
   var myDate = new Date();
   var months = ['January','February','March','April','May','June','July','August','September','October','November','December'];
   var m = myDate.getMonth();
   var year = myDate.getYear() + 1900;
   if(m == 0){
      m = 11;
      year = year - 1;
   }else{
      m--;
   }
   var month = months[m];
</script>


And then paste this anywhere in the page you want to display the date
Code: Select all
<script type="text/javascript">document.write(month + ' ' + year);</script>


If you have any trouble or any questions, just post them and I'll get back to you asap.
  • 1
<--websta*-->

http://www.affilorama.com
 
Moderator
wollowra
Posts: 1283
Joined: 14 Mar 08
Trust:
Just out of interest Simon,
What do you need this for?

Regards
Troy
  • 1
Enjoy the little things, for one day you may look back and realize
they were the big things.

-- Robert Brault
 

This topic was started on Aug 20, 2009 and has been closed due to inactivity. If you want to discuss this topic further, please create a new forum topic.

cron