CronExpression_DayOfMonthField::isSatisfiedBy()publicWC 1.0


Method of the class: CronExpression_DayOfMonthField{}

No Hooks.


null. Nothing (null).


$CronExpression_DayOfMonthField = new CronExpression_DayOfMonthField();
$CronExpression_DayOfMonthField->isSatisfiedBy( $date, $value );
$date(DateTime) (required)
$value (required)

CronExpression_DayOfMonthField::isSatisfiedBy() code WC 8.6.1

public function isSatisfiedBy(DateTime $date, $value)
    // ? states that the field value is to be skipped
    if ($value == '?') {
        return true;

    $fieldValue = $date->format('d');

    // Check to see if this is the last day of the month
    if ($value == 'L') {
        return $fieldValue == $date->format('t');

    // Check to see if this is the nearest weekday to a particular value
    if (strpos($value, 'W')) {
        // Parse the target day
        $targetDay = substr($value, 0, strpos($value, 'W'));
        // Find out if the current day is the nearest day of the week
        return $date->format('j') == self::getNearestWeekday(

    return $this->isSatisfied($date->format('d'), $value);