Thread: Third Sunday
View Single Post
  #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
  Webmaster Forums - View Single Post - Third Sunday
Thread: Third Sunday
View Single Post
  #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