» Quick Links
You can make money on these forums
We Share profits with you
Google
Google Adsense
Google Adwords
YPN
Yahoo
MSN Search
Web Directories
Web Hosting
Web Hosting Offers
Hosting News
Suggestions
Link Building
Domain Names
PHP Forums
MySQL Forums
» More Links
OSP News
Reseller Hosting
Shared Hosting
Dedicated Servers
Google Adsense
Search Engine Marketing
Link Development
Affiliate Marketing


» Advertising
Multiple DC PR Check

Free SEO Tools


Go Back   Webmaster Forums > Website Developement / Programming > PHP Programming and Tips

PHP Programming and Tips Discuss about PHP programming and Share Tips. Ask questions about Scripting and Errors.

Reply
 
Thread Tools Display Modes
  #1  
Old 08-28-2006, 02:02 PM
diggal diggal is offline
Junior Member
 
Join Date: Aug 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
diggal is on a distinguished road
Default Third Sunday

I need to have a page check if it is the third Sunday of a month and print the date of the next meeting which is the third Sunday. If the date is past the third Sunday, it need to print the date for the following month.

This is what I have so far:


PHP Code:
<?php
print ("<span style=\"color:#006699;\">");
echo "Sunday, " . date("F j, Y",strtotime("Third Sunday"));
print ("</span>");
?>


This works fine for the current month, but does not update itself for the following month. -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
Revenue Sharing Ads ( ?):
  #2  
Old 08-28-2006, 02:04 PM
fcuk fcuk is offline
Junior Member
 
Join Date: Aug 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
fcuk is on a distinguished road
Default

Try this code


function getDay($year = 2006, $month = 1, $checkDay = 'Sun', $repeat = 3) {
$dateFormat = date('Ymd', strtotime($year . $month . '01'));

$currentMonth = $month;
$month = $currentMonth;
if ($currentMonth < 10) {
$month = '0' . $currentMonth;
}

$daysInMonth = date('t', $dateFormat);
$dayStore = array();
$j = 1;
for ($i = 1; $i <= $daysInMonth; $i++) {
$day = $i;
if ($i < 10) {
$day = '0' . $i;
}
if (date('D', strtotime($year . $month . $day)) == $checkDay) {
$dayStore[$j] = $i;
$j++;
}
}
return $dayStore[$repeat];
}

// -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 05:02 PM.