Returns whether the supplied timezoned date time is within (inclusive) the date time range.

@param TimezonedDateTime $timezonedDateTime

@return bool
323629
public function contains(TimezonedDateTime $timezonedDateTime) : bool
    {
        return $this->start->comesBeforeOrEqual($timezonedDateTime) && $this->end->comesAfterOrEqual($timezonedDateTime);
    }
736098
public function matches(\DateTime $date)
    {
        foreach ($this->fields as $field) {
            if (!$field->matches($date)) {
                return false;
            }
        }

        return true;
    }
557201
protected function isValidTimeZoneId($timeZone)
    {
        return ($this->isValidIanaTimeZoneId($timeZone) !== false || $this->isValidCldrTimeZoneId($timeZone) !== false);
    }
370222
public function datetime($value): bool
    {
        if (!is_scalar($value)) {
            return false;
        }

        if (is_numeric($value)) {
            return true;
        }

        return (int)strtotime($value) != 0;
    }
63349
private function validateDateTime($datetime)
    {
        if (preg_match('/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})$/', $datetime, $parts) == true) {
            $time = gmmktime($parts[4], $parts[5], $parts[6], $parts[2], $parts[3], $parts[1]);

            $input_dt = new \DateTime($datetime, new \DateTimeZone('GMT0'));
            $input_time = $input_dt->getTimestamp();
            if ($input_time === false) return false;

            return $input_time == $time;
        } else {
            return false;
        }
    }
545017
public static boolean isCurrentTimeBetweenTowTimes(Date fromDate, Date fromTime, Date toDate, Date timeTo) {
		JKTimeObject currntTime = getCurrntTime();
		JKTimeObject fromTimeObject = new JKTimeObject();
		JKTimeObject toTimeObject = new JKTimeObject();
		if (currntTime.after(fromTimeObject.toTimeObject(fromDate, fromTime)) && currntTime.before(toTimeObject.toTimeObject(toDate, timeTo))) {
			return true;
		}
		return false;
	}
66517
private function checkTime()
    {
        if (is_null($this->timeLimit)) {
            return false;
        }

        if (($this->startTime + $this->timeLimit) <= time()) {
            return true;
        }
        return false;
    }
555434
public function isToday(): bool
    {
        return $this->date->format('Y-m-d') === Date::now($this->date->timezone())->format('Y-m-d');
    }
1180098
private static function isValidTimezone(string $timezone): bool
    {
        // @codeCoverageIgnoreStart
        if (self::$timezones === null) {
            self::$timezones = [];
            foreach (timezone_identifiers_list() as $zone) {
                self::$timezones[$zone] = true;
            }
        }
        // @codeCoverageIgnoreEnd

        return isset(self::$timezones[$timezone]);
    }
507616
@Override
  public boolean isTimeIncluded (final long timeStamp)
  {
    if (super.isTimeIncluded (timeStamp) == false)
    {
      return false;
    }

    final Date lookFor = getStartOfDayJavaCalendar (timeStamp).getTime ();

    return !(m_aDates.contains (lookFor));
  }
1226677
public function isPublished(DateTime $time = null)
    {
        $timestamp = $time ? $time->getTimestamp() : time();

        return $this->{self::ATTR_EMBARGOED_UNTIL} && $this->{self::ATTR_EMBARGOED_UNTIL} <= $timestamp;
    }
234086
public static function isValidDateTime($dateTime)
    {
        $t = explode(' ', $dateTime);
        if ($this->isValidDate($t[0]) && $this->isValidDate($t[1])) {
            return true;
        } else {
            return false;
        }
    }
179729
public T toDateTime(String dateTime, String timeZoneId) {
    return toDateTime(ISODateTimeFormat.dateHourMinuteSecond().parseDateTime(dateTime)
        .withZoneRetainFields(DateTimeZone.forTimeZone(TimeZone.getTimeZone(timeZoneId))));
  }
297790
public function getDeletedAtDatetime(string $timezone = null): ?DateTime
    {
        if (!$this->isDeleted()) {
            return null;
        }

        return new DateTime($this->getDeletedAt(), new DateTimeZone($timezone ?? 'UTC'));
    }
1243259
public boolean isMatch(ZonedDateTime date) {
        // Issue #200: Truncating the date to the least granular precision supported by different cron systems.
        // For Quartz, it's seconds while for Unix & Cron4J it's minutes.
        final boolean isSecondGranularity = cronDefinition.containsFieldDefinition(SECOND);
        if (isSecondGranularity) {
            date = date.truncatedTo(SECONDS);
        } else {
            date = date.truncatedTo(ChronoUnit.MINUTES);
        }

        final Optional<ZonedDateTime> last = lastExecution(date);
        if (last.isPresent()) {
            final Optional<ZonedDateTime> next = nextExecution(last.get());
            if (next.isPresent()) {
                return next.get().equals(date);
            } else {
                boolean everythingInRange = false;
                try {
                    everythingInRange = dateValuesInExpectedRanges(nextClosestMatch(date), date);
                } catch (final NoSuchValueException ignored) {
                    // Why is this ignored?
                }
                try {
                    everythingInRange = dateValuesInExpectedRanges(previousClosestMatch(date), date);
                } catch (final NoSuchValueException ignored) {
                    // Why is this ignored?
                }
                return everythingInRange;
            }
        }
        return false;
    }
1086994
public function isValidCldrTimeZoneId($timeZone, $doConversion = false)
    {
        $timeZone = html_entity_decode($timeZone);

        $cldrTimeZones = array(
            '(UTC-12:00) International Date Line West'                      => 'Etc/GMT+12',
            '(UTC-11:00) Coordinated Universal Time-11'                     => 'Etc/GMT+11',
            '(UTC-10:00) Hawaii'                                            => 'Pacific/Honolulu',
            '(UTC-09:00) Alaska'                                            => 'America/Anchorage',
            '(UTC-08:00) Pacific Time (US & Canada)'                        => 'America/Los_Angeles',
            '(UTC-07:00) Arizona'                                           => 'America/Phoenix',
            '(UTC-07:00) Chihuahua, La Paz, Mazatlan'                       => 'America/Chihuahua',
            '(UTC-07:00) Mountain Time (US & Canada)'                       => 'America/Denver',
            '(UTC-06:00) Central America'                                   => 'America/Guatemala',
            '(UTC-06:00) Central Time (US & Canada)'                        => 'America/Chicago',
            '(UTC-06:00) Guadalajara, Mexico City, Monterrey'               => 'America/Mexico_City',
            '(UTC-06:00) Saskatchewan'                                      => 'America/Regina',
            '(UTC-05:00) Bogota, Lima, Quito, Rio Branco'                   => 'America/Bogota',
            '(UTC-05:00) Chetumal'                                          => 'America/Cancun',
            '(UTC-05:00) Eastern Time (US & Canada)'                        => 'America/New_York',
            '(UTC-05:00) Indiana (East)'                                    => 'America/Indianapolis',
            '(UTC-04:00) Asuncion'                                          => 'America/Asuncion',
            '(UTC-04:00) Atlantic Time (Canada)'                            => 'America/Halifax',
            '(UTC-04:00) Caracas'                                           => 'America/Caracas',
            '(UTC-04:00) Cuiaba'                                            => 'America/Cuiaba',
            '(UTC-04:00) Georgetown, La Paz, Manaus, San Juan'              => 'America/La_Paz',
            '(UTC-04:00) Santiago'                                          => 'America/Santiago',
            '(UTC-03:30) Newfoundland'                                      => 'America/St_Johns',
            '(UTC-03:00) Brasilia'                                          => 'America/Sao_Paulo',
            '(UTC-03:00) Cayenne, Fortaleza'                                => 'America/Cayenne',
            '(UTC-03:00) City of Buenos Aires'                              => 'America/Buenos_Aires',
            '(UTC-03:00) Greenland'                                         => 'America/Godthab',
            '(UTC-03:00) Montevideo'                                        => 'America/Montevideo',
            '(UTC-03:00) Salvador'                                          => 'America/Bahia',
            '(UTC-02:00) Coordinated Universal Time-02'                     => 'Etc/GMT+2',
            '(UTC-01:00) Azores'                                            => 'Atlantic/Azores',
            '(UTC-01:00) Cabo Verde Is.'                                    => 'Atlantic/Cape_Verde',
            '(UTC) Coordinated Universal Time'                              => 'Etc/GMT',
            '(UTC+00:00) Casablanca'                                        => 'Africa/Casablanca',
            '(UTC+00:00) Dublin, Edinburgh, Lisbon, London'                 => 'Europe/London',
            '(UTC+00:00) Monrovia, Reykjavik'                               => 'Atlantic/Reykjavik',
            '(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna'  => 'Europe/Berlin',
            '(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague' => 'Europe/Budapest',
            '(UTC+01:00) Brussels, Copenhagen, Madrid, Paris'               => 'Europe/Paris',
            '(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb'                  => 'Europe/Warsaw',
            '(UTC+01:00) West Central Africa'                               => 'Africa/Lagos',
            '(UTC+02:00) Amman'                                             => 'Asia/Amman',
            '(UTC+02:00) Athens, Bucharest'                                 => 'Europe/Bucharest',
            '(UTC+02:00) Beirut'                                            => 'Asia/Beirut',
            '(UTC+02:00) Cairo'                                             => 'Africa/Cairo',
            '(UTC+02:00) Chisinau'                                          => 'Europe/Chisinau',
            '(UTC+02:00) Damascus'                                          => 'Asia/Damascus',
            '(UTC+02:00) Harare, Pretoria'                                  => 'Africa/Johannesburg',
            '(UTC+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius'     => 'Europe/Kiev',
            '(UTC+02:00) Jerusalem'                                         => 'Asia/Jerusalem',
            '(UTC+02:00) Kaliningrad'                                       => 'Europe/Kaliningrad',
            '(UTC+02:00) Tripoli'                                           => 'Africa/Tripoli',
            '(UTC+02:00) Windhoek'                                          => 'Africa/Windhoek',
            '(UTC+03:00) Baghdad'                                           => 'Asia/Baghdad',
            '(UTC+03:00) Istanbul'                                          => 'Europe/Istanbul',
            '(UTC+03:00) Kuwait, Riyadh'                                    => 'Asia/Riyadh',
            '(UTC+03:00) Minsk'                                             => 'Europe/Minsk',
            '(UTC+03:00) Moscow, St. Petersburg, Volgograd'                 => 'Europe/Moscow',
            '(UTC+03:00) Nairobi'                                           => 'Africa/Nairobi',
            '(UTC+03:30) Tehran'                                            => 'Asia/Tehran',
            '(UTC+04:00) Abu Dhabi, Muscat'                                 => 'Asia/Dubai',
            '(UTC+04:00) Baku'                                              => 'Asia/Baku',
            '(UTC+04:00) Izhevsk, Samara'                                   => 'Europe/Samara',
            '(UTC+04:00) Port Louis'                                        => 'Indian/Mauritius',
            '(UTC+04:00) Tbilisi'                                           => 'Asia/Tbilisi',
            '(UTC+04:00) Yerevan'                                           => 'Asia/Yerevan',
            '(UTC+04:30) Kabul'                                             => 'Asia/Kabul',
            '(UTC+05:00) Ashgabat, Tashkent'                                => 'Asia/Tashkent',
            '(UTC+05:00) Ekaterinburg'                                      => 'Asia/Yekaterinburg',
            '(UTC+05:00) Islamabad, Karachi'                                => 'Asia/Karachi',
            '(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi'               => 'Asia/Calcutta',
            '(UTC+05:30) Sri Jayawardenepura'                               => 'Asia/Colombo',
            '(UTC+05:45) Kathmandu'                                         => 'Asia/Katmandu',
            '(UTC+06:00) Astana'                                            => 'Asia/Almaty',
            '(UTC+06:00) Dhaka'                                             => 'Asia/Dhaka',
            '(UTC+06:30) Yangon (Rangoon)'                                  => 'Asia/Rangoon',
            '(UTC+07:00) Bangkok, Hanoi, Jakarta'                           => 'Asia/Bangkok',
            '(UTC+07:00) Krasnoyarsk'                                       => 'Asia/Krasnoyarsk',
            '(UTC+07:00) Novosibirsk'                                       => 'Asia/Novosibirsk',
            '(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi'             => 'Asia/Shanghai',
            '(UTC+08:00) Irkutsk'                                           => 'Asia/Irkutsk',
            '(UTC+08:00) Kuala Lumpur, Singapore'                           => 'Asia/Singapore',
            '(UTC+08:00) Perth'                                             => 'Australia/Perth',
            '(UTC+08:00) Taipei'                                            => 'Asia/Taipei',
            '(UTC+08:00) Ulaanbaatar'                                       => 'Asia/Ulaanbaatar',
            '(UTC+09:00) Osaka, Sapporo, Tokyo'                             => 'Asia/Tokyo',
            '(UTC+09:00) Pyongyang'                                         => 'Asia/Pyongyang',
            '(UTC+09:00) Seoul'                                             => 'Asia/Seoul',
            '(UTC+09:00) Yakutsk'                                           => 'Asia/Yakutsk',
            '(UTC+09:30) Adelaide'                                          => 'Australia/Adelaide',
            '(UTC+09:30) Darwin'                                            => 'Australia/Darwin',
            '(UTC+10:00) Brisbane'                                          => 'Australia/Brisbane',
            '(UTC+10:00) Canberra, Melbourne, Sydney'                       => 'Australia/Sydney',
            '(UTC+10:00) Guam, Port Moresby'                                => 'Pacific/Port_Moresby',
            '(UTC+10:00) Hobart'                                            => 'Australia/Hobart',
            '(UTC+10:00) Vladivostok'                                       => 'Asia/Vladivostok',
            '(UTC+11:00) Chokurdakh'                                        => 'Asia/Srednekolymsk',
            '(UTC+11:00) Magadan'                                           => 'Asia/Magadan',
            '(UTC+11:00) Solomon Is., New Caledonia'                        => 'Pacific/Guadalcanal',
            '(UTC+12:00) Anadyr, Petropavlovsk-Kamchatsky'                  => 'Asia/Kamchatka',
            '(UTC+12:00) Auckland, Wellington'                              => 'Pacific/Auckland',
            '(UTC+12:00) Coordinated Universal Time+12'                     => 'Etc/GMT-12',
            '(UTC+12:00) Fiji'                                              => 'Pacific/Fiji',
            "(UTC+13:00) Nuku'alofa"                                        => 'Pacific/Tongatapu',
            '(UTC+13:00) Samoa'                                             => 'Pacific/Apia',
            '(UTC+14:00) Kiritimati Island'                                 => 'Pacific/Kiritimati',
        );

        if (array_key_exists($timeZone, $cldrTimeZones)) {
            if ($doConversion) {
                return $cldrTimeZones[$timeZone];
            } else {
                return true;
            }
        }

        return false;
    }
1199077
protected function checkTime()
    {
        $result = false;

        $lastExecution = $this->getExecutionTime();
        $interval = $this->getInterval();
        $anonymous = \common_session_SessionManager::isAnonymous();

        if ($lastExecution === null && !$anonymous) {
            $result = true;
        } elseif($lastExecution !== null && $interval !== null && !$anonymous) {
            $mustBeExecutedAt = clone($lastExecution);
            $mustBeExecutedAt->add($interval);
            $now = new DateTime('now');
            $result = ($mustBeExecutedAt < $now);
        }

        return $result;
    }