\CronDayOfMonthField

Day of month field. Allows: * , / - ? L W

'L' stands for "last" and specifies the last day of the month.

The 'W' character is used to specify the weekday (Monday-Friday) nearest the given day. As an example, if you were to specify "15W" as the value for the day-of-month field, the meaning is: "the nearest weekday to the 15th of the month". So if the 15th is a Saturday, the trigger will fire on Friday the 14th. If the 15th is a Sunday, the trigger will fire on Monday the 16th. If the 15th is a Tuesday, then it will fire on Tuesday the 15th. However if you specify "1W" as the value for day-of-month, and the 1st is a Saturday, the trigger will fire on Monday the 3rd, as it will not 'jump' over the boundary of a month's days. The 'W' character can only be specified when the day-of-month is a single day, not a range or list of days.

Summary

Methods
Properties
Constants
isSatisfied()
isRange()
isIncrementsOfRanges()
isInRange()
isInIncrementsOfRanges()
getRangeForExpression()
isSatisfiedBy()
increment()
validate()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
getNearestWeekday()
No private properties found
N/A

Methods

isSatisfied()

isSatisfied(string  $dateValue, string  $value) : boolean

Check to see if a field is satisfied by a value

Parameters

string $dateValue

Date value to check

string $value

Value to test

Returns

boolean

isRange()

isRange(string  $value) : boolean

Check if a value is a range

Parameters

string $value

Value to test

Returns

boolean

isIncrementsOfRanges()

isIncrementsOfRanges(string  $value) : boolean

Check if a value is an increments of ranges

Parameters

string $value

Value to test

Returns

boolean

isInRange()

isInRange(string  $dateValue, string  $value) : boolean

Test if a value is within a range

Parameters

string $dateValue

Set date value

string $value

Value to test

Returns

boolean

isInIncrementsOfRanges()

isInIncrementsOfRanges(string  $dateValue, string  $value) : boolean

Test if a value is within an increments of ranges (offset[-to]/step size)

Parameters

string $dateValue

Set date value

string $value

Value to test

Returns

boolean

getRangeForExpression()

getRangeForExpression(string  $expression, integer  $max) : array

Returns a range of values for the given cron expression

Parameters

string $expression

The expression to evaluate

integer $max

Maximum offset for range

Returns

array

isSatisfiedBy()

isSatisfiedBy(\DateTime  $date,   $value) 

Parameters

\DateTime $date
$value

increment()

increment(\DateTime  $date,   $invert = false) 

Parameters

\DateTime $date
$invert

validate()

validate(string  $value) : boolean

Validates that the value is valid for the Day of the Month field Days of the month can contain values of 1-31, *, L, or ? by default. This can be augmented with lists via a ',', ranges via a '-', or with a '[0-9]W' to specify the closest weekday.

Parameters

string $value

Returns

boolean

getNearestWeekday()

getNearestWeekday(integer  $currentYear, integer  $currentMonth, integer  $targetDay) : \DateTime

Get the nearest day of the week for a given day in a month

Parameters

integer $currentYear

Current year

integer $currentMonth

Current month

integer $targetDay

Target day of the month

Returns

\DateTime —

Returns the nearest date