Check if the Job is due to run.
It accepts as input a DateTime used to check if
the job is due. Defaults to job creation time.
It also default the execution time if not previously defined.

@param  \DateTime $date
@return bool
354160
public function isDue(\DateTime $date = null)
    {
        // The execution time is being defaulted if not defined
        if (!$this->executionTime) {
            $this->at('* * * * *');
        }

        $date = $date ?? $this->creationTime;

        return $this->executionTime->isDue($date);
    }
615545
private function matchesHash($hash, \DateTime $date)
    {
        $ordinals = array(
            '1' => 'first',
            '2' => 'second',
            '3' => 'third',
            '4' => 'fourth',
            '5' => 'fifth'
        );
        $hashParts = explode('#', $hash);

        if ($hashParts[0] != $this->getFieldValueFromDate($date)) {
            return false;
        }

        return $this->matchesRelativeDate($date, $ordinals[$hashParts[1]]);
    }
1155862
public function isDate() {
        $this->check_role = 'date';
        $result = false !== strtotime($this->value);
        $this->checkResult($result);
        return $this;
    }
91025
public static function isDate($date = false, $format = 'Y-m-d H:i:s') {

        if($date) {

            $DateTime = DateTime::createFromFormat($format, $date);
            return $DateTime && $DateTime->format($format) == $date;
        }
        
        return false;
    }
1347058
public static function fromDateTime(DateTime $date)
    {
        $workday = new static("@" . $date->getTimestamp());
        $workday->setTimezone($date->getTimezone());

        return $workday;
    }
270487
public static function isDateTime($date, string $format = null): bool
    {
        if ($date instanceof \DateTime) {
            return true;
        }

        if (false === is_string($date)) {
            return false;
        }

        if ($format) {
            return \DateTime::createFromFormat($format, $date) instanceof \DateTime;
        }

        return (bool)strtotime($date);
    }
212389
private function isValidDate($date)
    {
        $date = str_replace('/', '-', $date);

        return (date_create($date)) ? JFactory::getDate($date)->format("Y-m-d") : null;
    }
46695
public static function isPresent($date, $time = null)
    {
        if (is_null($time)) {
            $time = self::time();
        }
        if (!is_int($date)) {
            $date = self::strtotime($date);
        }

        return $time === $date;
    }
496442
private function isDatetime($dateTime)
    {
        if (preg_match('/^(\d{4})-(\d\d?)-(\d\d?) (\d\d?):(\d\d?):(\d\d?)$/', $dateTime, $matches)) {
            return checkdate($matches[2], $matches[3], $matches[1]) && $matches[4] / 24 < 1 && $matches[5] / 60 < 1 && $matches[6] / 60 < 1;
        }
        return false;
    }
784827
public function includes(DateTime $datetime)
	{
		return !$datetime->isBefore($this->start) && !$datetime->isAfter($this->end);
	}
430884
public function run(\DateTime $runTime = null)
    {
        $this->loadSavedJobs();

        list($background, $foreground) = $this->getQueuedJobs(false);
        $alljobs = array_merge($background, $foreground);

        if (null === $runTime) {
            $runTime = new \DateTime('now');
        }

        // Star processing jobs
        foreach ($alljobs as $job) {
            if ($job->isDue($runTime)) {
                $job->run();
                $this->jobs_run[] = $job;
            }
        }

        // Finish handling any background jobs
        foreach($background as $job) {
            $job->finalize();
        }

        // Store states
        $this->saveJobStates();
    }
210865
public static function ruleDateTime()
    {
        return function ($input) {
            $date = null;
            try {
                $date = date_parse($input);
                return $date['warning_count'] === 0 && $date['error_count'] === 0;
            }
            catch(\Exception $e) {
                return false;
            }
        };
    }
1167891
public function hasFor($key, \DateTime $date)
    {
        return array_key_exists($this->keyFor($key, $date), $this->data);
    }
162904
public static function isValid($date)
	{
		if(self::validateXSDDateTimeFormat($date) && self::validateXSDDateTimeValue($date))
		{
			return true;
		}
		else
		{
			return false;
		}
	}
882835
public function contains(LocalDate $date) : bool
    {
        return ! ($date->isBefore($this->startDate) || $date->isAfter($this->endDate));
    }
411810
protected static function convertDateTime($date)
    {
        if (!$date) {
            return;
        }

        $date = new \DateTime($date);
        $date->setTimezone(new \DateTimeZone(date_default_timezone_get()));

        return $date->format(\DateTime::ISO8601);
    }
268646
public function isRunning(Datetime $current = null)
    {
        $current = $current ?: new Datetime;

        return $this->hasStarted($current) && !$this->hasEnded($current);
    }