Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Looking for script to display month/date
Old 04-18-2007, 07:37 PM Looking for script to display month/date
Novice Talker

Posts: 9
Trades: 0
I belong to an organization that holds meetings on the third Wednesday of every month. On our homepage, I have a header that says "The Next Meeting will be on _________."

Is there a script I could add that automatically displays the appropriate month/day of the third Wednesday of each month?

Today happens to be the third Wednesday (April 18th) and we have a meeting scheduled this evening. After tonight, I would like something that automatically changes the date to May 16th, then after May 16th passes, changes the date to June 20th, and so on...

I'm not a coder, so be easy on me...

Thanks for the help!
seligman1 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-19-2007, 07:42 PM Re: Looking for script to display month/date
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Not too difficult a problem

In javascript, so the thread will be moving
This bit between the document <head> </head> tags
HTML Code:
<script type="text/javascript">
var days = new Array(3,2,1,0,6,5,4)
var months = new Array("January","February","March","April","May","June","July","August","September","October","November","December")
var today = new Date();

function thirdWed() {
var firstDay = new Date();
firstDay.setDate(1);
thirdDate = firstDay.getDate() + days[firstDay.getDay()] +14;
if (today.getDate() > thirdDate) {
	firstDay.setMonth(today.getMonth() +1);
	return firstDay.getDate() + days[firstDay.getDay()] +14 + " " + months[firstDay.getMonth()];
	} else {
	return thirdDate + " "  + months[today.getMonth()];
	}
}
	
</script>
This goes where you want to display the date
HTML Code:
<script type="text/javascript">

document.write(thirdWed()  + "  " + today.getFullYear());
</script>
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Looking for script to display month/date
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.70582 seconds with 12 queries