Tribe__Date_Utils::get_last_day_of_week_in_month( int $curdate, int $day_of_week )

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.


Parameters

$curdate

(int) (Required) A timestamp.

$day_of_week

(int) (Required) The index of the day of the week.


Top ↑

Return

(int) The timestamp of the date that fits the qualifications.


Top ↑

Source

File: src/Tribe/Date_Utils.php

		public static function get_last_day_of_week_in_month( $curdate, $day_of_week ) {
			$nextdate = mktime( date( 'H', $curdate ), date( 'i', $curdate ), date( 's', $curdate ), date( 'n', $curdate ), self::get_last_day_of_month( $curdate ), date( 'Y', $curdate ) );;

			while ( date( 'N', $nextdate ) != $day_of_week && $day_of_week != - 1 ) {
				$nextdate = strtotime( date( self::DBDATETIMEFORMAT, $nextdate ) . ' - 1 day' );
			}

			return $nextdate;
		}