예제 #1
0
 /**
  * Gets the last day of the week in a month (ie the last Tuesday).  Passing in -1 gives you the last day in the month.
  *
  * @param int $curdate     A timestamp.
  * @param int $day_of_week The index of the day of the week.
  *
  * @return int The timestamp of the date that fits the qualifications.
  */
 public static function getLastDayOfWeekInMonth($curdate, $day_of_week)
 {
     $nextdate = mktime(date("H", $curdate), date("i", $curdate), date("s", $curdate), date('n', $curdate), Tribe__Events__Date_Utils::getLastDayOfMonth($curdate), date('Y', $curdate));
     while (date('N', $nextdate) != $day_of_week && $day_of_week != -1) {
         $nextdate = strtotime(date(Tribe__Events__Pro__Date_Series_Rules__Rules_Interface::DATE_FORMAT, $nextdate) . " - 1 day");
     }
     return $nextdate;
 }