校验值是否是日期并且是否满足设定格式
@param string $date 日期
@param string $format 需要检验的格式数组
@return boolean
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;
    }
905167
public function getDateTimeFormat(string $format='Y-m-d H:i:s')
    {
        $this->setDateTimeZone()->setDateTime();

        return $this->dateTime->format($format);
    }
1163971
public function getDate($format = null)
    {
        if (empty($format)) {
            return $this->get('__date__')->sec;
        }
        
        return date($format, $this->get('__date__')->sec);
    }
646610
protected function isValidDate($date)
    {
        $dt = DateTime::createFromFormat('Y-m-d', $date);

        return ($dt !== false && !array_sum($dt->getLastErrors()));
    }
1075073
protected function formatDateTime(\DateTime $date = null, $format = null)
    {
        return $date && $format ?
            $date->format($format) :
            $date
        ;
    }
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);
    }
681352
public static function DateFormat($format, $date = null)
  {
    if (!empty($date) && !is_int($date)) {
      $date = strtotime($date);
    }

    return strftime($format, $date ?: time());
  }
1081150
public static function valid(string $date, string $format): bool {
        return date($format, strtotime($date)) === $date;

    }
308046
public static function parseDate($date, $format){
        if( $format == "d/m/Y" ) return self::parseDate1($date, $format);
        if( $format == "Y-m-d" ) return self::parseDate2($date, $format);
        return null;
    }
642738
public static String getFormatDate(String format, Date date) {
        return getFormatDate(format, date, ZoneId.systemDefault().getId());
    }
467422
public function rule_date_format( $key, $value, $format = 'd/m/Y' ) 
	{
		return date( $format, strtotime( trim( $value ) ) ) == trim( $value );
	}
18859
private static Date toDateWithFormatString(String date, String format) {
    if (date == null) {
      return null;
    }

    try {
      return strategy.formatFor(format).parse(date);
    } catch (ParseException e) {
      UTILS_LOGGER.trace("Unable to parse date '{}' using format string '{}': {}", date, format, e);

      return null;
    }
  }
237548
public function setDate($date, $format = DATE_FORMAT_ISO)
    {
        if ($date instanceof AnDate) {
            $this->copy($date);
        } elseif (is_array($date) || $date instanceof AnConfig) {
            foreach ($date as $key => $value) {
                $this->$key = $value;
            }
        } else {
            parent::setDate($date, $format);
        }

        return $this;
    }
197298
public static function toFormat($date, $format, $local = false)
    {
        if (is_string($date)) {
            $date = new static($date);
        }

        return $date->format($format, $local);
    }
212389
private function isValidDate($date)
    {
        $date = str_replace('/', '-', $date);

        return (date_create($date)) ? JFactory::getDate($date)->format("Y-m-d") : null;
    }
1120660
public function whereDate($field, $date, $format = null)
    {
        if ($format === null) {
            if ($this->_model) {
                $format = $this->_model->getDateFormat($field);
            } else {
                $format = is_int($date) ? 'U' : 'Y-m-d H:i:s';
            }
        }

        $ts = is_int($date) ? $date : strtotime($date);

        if ($format === 'U') {
            $min = date('Y-m-d 00:00:00', $ts);
            $max = date('Y-m-d 23:59:59', $ts);
            return $this->whereBetween($field, strtotime($min), strtotime($max));
        } else {
            $min = date(str_replace('H:i:s', '00:00:00', $format), $ts);
            $max = date(str_replace('H:i:s', '23:59:59', $format), $ts);
            return $this->whereBetween($field, $min, $max);
        }
    }
199243
public static function verifyDateTime(string $datetime, string $format): bool
    {
        $formatted = DateTime::createFromFormat($format, $datetime);

        $errors = DateTime::getLastErrors();

        if (!empty($errors['warning_count'])) {
            return false;
        }

        return $formatted !== false;
    }