Validate is date.

@param string|int $date
@return bool
420030
public static function is($date)
    {
        if (is_bool($date) || empty($date) xor ($date === 0 || $date === '0')) {
            return false;
        }
        $date = static::isTimestamp($date) ? '@' . (string)$date : $date;
        return (bool)date_create($date);
    }
163346
protected static function prepareDate($date)
    {
        if (null === $date) {
            return null;
        }
        if ($date instanceof DateTime) {
            return static::timeToString($date->getTimestamp());
        } elseif (is_numeric($date)) {
            return static::timeToString($date);
        } elseif (is_array($date)) {
            return @$date['date'];
        } elseif (self::hasTimestamp($date)) {
            return static::timeToString($date->getTimestamp());
        } elseif (is_string($date)) {
            return false !== strtotime($date) ? $date : null;
        }

        return null;
    }
237060
final public static function asSql($date)
    {
        if (!empty($date)) {
            if ($date instanceof \DateTimeInterface) {
                return $date->format('Y-m-d H:i:sO');
            } else {
                return self::asDateTime($date)->format('Y-m-d H:i:sO');
            }
        } else {
            return null;
        }
    }
1296700
public function is_after($date)
  {
    //check if the argument $date is an instance of this class
    if ( $date instanceof $this){
      $tmp = $date;
    }
    else {
      $tmp = new \bbn\time($date);
    }
    return $this->get_time() > $tmp->get_time(); 
  }
1098965
@Deprecated
	public static boolean isValidDate(String date) {
		try {
			convertStringDateToTime(date);
			return true;
		} catch (IllegalArgumentException err) {
			return false;
		}
	}
14121
public static function isDateFormat($date, $format = 'Y-m-d')
    {
        if (!$unixTime = strtotime($date)) {
            return false;
        }

        // 校验日期的格式有效性
        if (date($format, $unixTime) === $date) {
            return true;
        }

        return false;
    }
170727
public function containsDate($date): bool
    {
        $date = Date::castFrom($date);
        if (!$this->start->isBefore($date) && !$this->start->equals($date)) {
            return false;
        }

        if (!$this->end->isAfter($date) && !$this->end->equals($date)) {
            return false;
        }

        return true;
    }
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);
    }
179025
public static function parseForumDate(string $date): ?\DateTimeImmutable
    {
        if (!preg_match('/\d{4}/', $date)) {
            $date .= ', '.date('Y');
        }

        return self::parseDate($date);
    }
865299
public static function validate($string)
    {
        try {
            if (is_numeric($string) && (int)$string == $string) {
                $date = new DateTime('@' . $string);
            } else {
                $date = self::parse($string);
            }
        } catch (Exception $ex) {
            return false;
        }

        // String is empty or not a valid date
        if (empty($string) || $date === false) {
            return false;

            // String is a valid date
        } else {
            return true;
        }
    }
380021
public function date($date)
    {
        if (! $date instanceof DateTime) {
            $date = new DateTime($date);
        }

        $this->executionYear = $date->format('Y');

        return $this->at("{$date->format('i')} {$date->format('H')} {$date->format('d')} {$date->format('m')} *");
    }
563795
public function parse($date) {
        if(is_int($date) || is_double($date) || (is_string($date) && preg_match('@^[0-9]+$@', $date))) {
            return (double)$date;
        } elseif($date instanceof Date) {
            return $date->getEpoch();
        } elseif(is_null($date)) {
            return false;
        } else {
            $date = trim(Assert::isString($date));
        }
        $date = $this->parseHoursMinutes($date);
        if(preg_match('@^[0-9]+$@', $date)) {
            return (int)$date;
        }
        $date = $this->stripTimezone($date);
        $date = $this->stripRange($date);

        if(preg_match('@^(\d{4}-\d{2}-\d{2} )?24:00(:00)?$@', trim($date), $matches)) {
            if(isset($matches[1]) && strlen($matches[1]) > 0) {
                $date = strtotime($matches[1]);
            } else {
                $date = time();
            }
            return mktime(0, 0, 0, date('n', $date), date('j', $date) + 1, date('Y', $date));

        }
        //change a/p to am/pm
        $date = preg_replace('@(^|[^a-z])(a|p)([^a-z]|$)@i', '\\1\\2m\\3', $date);
        //Add a colon from 315am,1215 am
        $date = preg_replace('@(^|[^0-9])(\d{1,2})(\d{2})\s*(am|pm)@i', '\\1\\2:\\3\\4', $date);

        //Fix for dashes instead of slashes
        $date = preg_replace('@(\d{2})-(\d{2})-(\d{4})@', '\\1/\\2/\\3', $date);
        //Fix for dots instead of slashes
        $date = preg_replace('@(\d{2})\.(\d{2})\.(\d{4})@', '\\1/\\2/\\3', $date);

        //Fix for UK/euro Version
        if(in_array(Formatter::getDefault()->getDateFormat(), array(Formatter::DATE_FORMAT_UK, Formatter::DATE_FORMAT_EURO))) {
            //Switch the d/m/Y to the US format m/d/Y to be able to parse
            $date = preg_replace('@(\d{2})/(\d{2})/(\d{4})@', '\\2/\\1/\\3', $date);
        }
        switch(strtolower($date)) {
            case '9999-12-31':
                return 253402232400;
                break;
            case '0000-00-00':
                return 0;
                break;
            case '0000-00-00 00:00:00':
                return 0;
                break;
            case '24:00:00':
            case '24:00':
                return mktime(0, 0, 0, date('n'), date('j') + 1, date('Y'));
                break;
            case 'thanksgiving':
                $firstDay = mktime(0, 0, 0, 11, 1);
                $add = 26 - date('w', $firstDay);
                if($add < 22) {
                    $add += 7;
                }
                return mktime(0, 0, 0, 11, $add);
                break;
            default:
                return strtotime($date);
        }
    }
215513
public function validDate($key) : bool
    {
        if ($this->param[$key] instanceof \DateTime) {
            return true;
        }

        $conCate = '';
        $columnName = ucfirst($this->convertToFieldName($key)).' is not';

        if (isset($this->errors[$key.self::ERROR])) {
            $conCate = str_replace('.', '', $this->errors[$key.self::ERROR]).' and ';
            $columnName = 'must be ';
        }

        $date = date_parse($this->param[$key]);
        $isDate = checkdate($date['month'], $date['day'], $date['year']);

        if (!$isDate) {
            $this->errors[$key.self::ERROR] = $conCate.$columnName.' valid date.';
        }

        return true;
    }
568895
protected function isToday(DateTime $date)
    {
        $today = new DateTime('now');
        $start = new DateTime($today->format('Y-m-d') . ' 00:00:00');
        $end   = new DateTime($today->format('Y-m-d') . ' 23:59:59');

        if ($date->getTimestamp() >= $start->getTimestamp() && $date->getTimestamp() <= $end->getTimestamp()) {
            return true;
        }
        return false;
    }
523241
public static function Validate($date, $format = DATEFORMAT::YMD, $separator = "/")
	{
		$timestamp = DateUtil::TimeStampFromStr($date, $format);
		$dateCheck = DateUtil::FormatDate($timestamp, $format, $separator, true);

		$date = $date . substr('--/--/---- 00:00:00', strlen($date));

		$timestamp2 = DateUtil::TimeStampFromStr($dateCheck, $format);
		return ($timestamp == $timestamp2) && ($date == $dateCheck);
	}
24352
public static function dateEquals($val, $date): bool
    {
        if (!$val || (!$time = \strtotime($val))) {
            return false;
        }

        return $date ? $time === \strtotime((string)$date) : false;
    }
197798
protected function _isExpired($date)
    {
        if ($date) {
            $years = substr($date, 2, 2);
            $month = substr($date, 0, 2);
            $day = date("t", mktime(11, 59, 59, $month, 1, $years));

            $expDate = mktime(23, 59, 59, $month, $day, $years);
            if (time() > $expDate) {
                return true;
            }
        }

        return false;
    }