/**
  * 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 && TribeDateUtils::isWeekday($nextdate)) && !($day_of_week == -2 && TribeDateUtils::isWeekend($nextdate))) {
         $nextdate = strtotime(date(DateSeriesRules::DATE_FORMAT, $nextdate) . " + 1 day");
     }
     return $nextdate;
 }