예제 #1
0
 /**
  * Gets the first day of the week in a month (ie the first Tuesday).
  *
  * @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 getFirstDayOfWeekInMonth($curdate, $day_of_week)
 {
     $nextdate = mktime(0, 0, 0, date('n', $curdate), 1, date('Y', $curdate));
     while (!($day_of_week > 0 && date('N', $nextdate) == $day_of_week) && !($day_of_week == -1 && Tribe__Events__Date_Utils::isWeekday($nextdate)) && !($day_of_week == -2 && Tribe__Events__Date_Utils::isWeekend($nextdate))) {
         $nextdate = strtotime(date(Tribe__Events__Pro__Date_Series_Rules__Rules_Interface::DATE_FORMAT, $nextdate) . " + 1 day");
     }
     return $nextdate;
 }