You are here

public function JobSchedulerCronTab::nextDate in Job Scheduler 8.3

Same name and namespace in other branches
  1. 8.2 src/JobSchedulerCronTab.php \Drupal\job_scheduler\JobSchedulerCronTab::nextDate()

Finds the next occurrence within the next year as a date array.

Parameters

array $date: Date array with: 'mday', 'mon', 'year', 'hours', 'minutes'.

int $limit: (optional) The time limit in days. Defaults to 366.

Return value

array|false A date array, or false if there was an error.

Overrides JobSchedulerCronTabInterface::nextDate

See also

getdate()

1 call to JobSchedulerCronTab::nextDate()
JobSchedulerCronTab::nextTime in src/JobSchedulerCronTab.php
Finds the next occurrence within the next year as unix timestamp.

File

src/JobSchedulerCronTab.php, line 95

Class

JobSchedulerCronTab
Class for job scheduler crontab.

Namespace

Drupal\job_scheduler

Code

public function nextDate(array $date, $limit = 366) {
  $date['seconds'] = 0;

  // It is possible that the current date doesn't match.
  if ($this
    ->checkDay($date) && ($nextdate = $this
    ->nextHour($date))) {
    return $nextdate;
  }
  elseif ($nextdate = $this
    ->nextDay($date, $limit)) {
    return $nextdate;
  }
  else {
    return FALSE;
  }
}