Attempts to check whether a SAML date is valid.  Returns true or false.
@param string $samlDate
@return bool
969380
function validSamlDateFormat($samlDate) 
   {
      if ($samlDate == "") return false;
      $indexT = strpos($samlDate, 'T');
      $indexZ = strpos($samlDate, 'Z');
      if (($indexT != 10) || ($indexZ != 19)) {
         return false;
      }
      $dateString = substr($samlDate, 0, 10);
      $timeString = substr($samlDate, $indexT + 1, 8);
      list($year, $month, $day) = explode('-', $dateString);
      list($hour, $minute, $second) = explode(':', $timeString);
      $parsedDate = gmmktime($hour, $minute, $second, $month, $day, $year);
      if (($parsedDate === false) || ($parsedDate == -1)) return false;
      if (!checkdate($month, $day, $year)) return false;
      return $parsedDate;
   }
1204142
private function isValidDate(string $date, string $format = 'Y-m-d') : bool
    {
        $d = DateTime::createFromFormat($format, $date);
        // The Y ( 4 digits year ) returns TRUE for any integer with any number of digits so changing the comparison from == to === fixes the issue.
        return $d && $d->format($format) === $date;
    }
701382
def valid_at(self, valid_date):
        ''''''
        is_valid = db.Q(validity__end__gt=valid_date,
                        validity__start__lte=valid_date)
        no_validity = db.Q(validity=None)
        return self(is_valid | no_validity)
1297774
public static function isValid($value)
    {
        if ($value instanceof \DateTime)
            return true;
        try {
            new static($value);
            return !is_null($value);
        } catch (\Exception $e) {
            return false;
        }
    }
422056
public function isDatesValid()
    {
        if ($this->startDate >= $this->endDate) {
            return false;
        }

        return ($this->endDate->diff($this->startDate)->days > 0);
    }
1371094
public function findInvalid($datetime = null)
    {
        $datetime = (null === $datetime) ? new \DateTime() : $datetime;

        return $this->createQueryBuilder('u')
            ->where('u.valid < :datetime')
            ->setParameter(':datetime', $datetime)
            ->getQuery()
            ->getResult();
    }
30738
public function validateCreatedAt($createdAt)
    {
        if (empty($createdAt)) {
            $this->addError('createdAt', 'Creation date and time cannot be empty');
            return false;
        }

        if (!$createdAt instanceof \DateTime) {
            $this->addError('createdAt', 'The creation date has to be and instance of \DateTime');
            return false;
        }

        return true;
    }
171530
public function isValid(\DateTime $lastCacheDate = null): bool
    {
        $publishedDateTime = $this->getLastUpdateDate();

        if ($publishedDateTime && $publishedDateTime < $lastCacheDate) {
            return true;
        }

        return null === $publishedDateTime && null !== $lastCacheDate;
    }
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;
    }
750558
private function checkDateIsValid($date, $canBeNull = false)
    {
        if ($date === null
            && $canBeNull
        ) {
            return;
        }

        Date::factory($date);
    }
681718
public static function isDate($date): bool
    {
        if (!\preg_match('/^([\d]{4})-((?:0?[\d])|(?:1[0-2]))-((?:0?[\d])|(?:[1-2][\d])|(?:3[01]))( [\d]{2}:[\d]{2}:[\d]{2})?$/',
            $date, $matches)) {
            return false;
        }

        return \checkdate((int)$matches[2], (int)$matches[3], (int)$matches[1]);
    }
1247891
public function isValid(): bool
    {
        return $this->result_code === ResponseInterface::RESULT_OK
            || $this->result_code === ResponseInterface::RESULT_RECEIPT_VALID_BUT_SUB_EXPIRED;
    }
129857
private function checkEncodedData(array $encodedData): bool
    {
        $isValid = true;
        foreach ($encodedData as $locale => $namespaceResources) {
            $isValid = $isValid === true &&
                empty($locale) === false &&
                is_array($namespaceResources) === true && $this->checkNamespaceResources($namespaceResources);
        }

        return $isValid;
    }
3556
private function isValidFormat($date)
    {
        foreach ($this->formats as $format) {
            if (date($format, strtotime($date)) == $date) {
                return true;
            }
        }

        return false;
    }
764315
def validate_timestamps(self):
        
        conditions_nodes = self.__query_assertion('/saml:Conditions')

        for conditions_node in conditions_nodes:
            nb_attr = conditions_node.get('NotBefore')
            nooa_attr = conditions_node.get('NotOnOrAfter')
            if nb_attr and OneLogin_Saml2_Utils.parse_SAML_to_time(nb_attr) > OneLogin_Saml2_Utils.now() + OneLogin_Saml2_Constants.ALLOWED_CLOCK_DRIFT:
                raise OneLogin_Saml2_ValidationError(
                    'Could not validate timestamp: not yet valid. Check system clock.',
                    OneLogin_Saml2_ValidationError.ASSERTION_TOO_EARLY
                )
            if nooa_attr and OneLogin_Saml2_Utils.parse_SAML_to_time(nooa_attr) + OneLogin_Saml2_Constants.ALLOWED_CLOCK_DRIFT <= OneLogin_Saml2_Utils.now():
                raise OneLogin_Saml2_ValidationError(
                    'Could not validate timestamp: expired. Check system clock.',
                    OneLogin_Saml2_ValidationError.ASSERTION_EXPIRED
                )
        return True
752841
public static boolean isDate(String strDate, String pattern) {
		try {
			parseDate(strDate, pattern);
			return true;
		} catch (Exception e) {
			return false;
		}
	}
714447
function validateDate($date = NULL)
    {
        if (!is_array($this->currentCert) || !isset($this->currentCert['tbsCertificate'])) {
            return false;
        }

        if (!isset($date)) {
            $date = time();
        }

        $notBefore = $this->currentCert['tbsCertificate']['validity']['notBefore'];
        $notBefore = isset($notBefore['generalTime']) ? $notBefore['generalTime'] : $notBefore['utcTime'];

        $notAfter = $this->currentCert['tbsCertificate']['validity']['notAfter'];
        $notAfter = isset($notAfter['generalTime']) ? $notAfter['generalTime'] : $notAfter['utcTime'];

        switch (true) {
            case $date < @strtotime($notBefore):
            case $date > @strtotime($notAfter):
                return false;
        }

        return true;
    }