Think\Db\Builder::parseDateTime PHP Метод

parseDateTime() защищенный Метод

日期时间条件解析
protected parseDateTime ( string $value, string $key, array $options = [], string $bindName = null, integer $bindType = null ) : string
$value string
$key string
$options array
$bindName string
$bindType integer
Результат string
    protected function parseDateTime($value, $key, $options = [], $bindName = null, $bindType = null)
    {
        // 获取时间字段类型
        $type = $this->query->getFieldsType($options);
        if (isset($type[$key])) {
            $info = $type[$key];
        }
        if (isset($info)) {
            $value = strtotime($value) ?: $value;
            if (preg_match('/(datetime|timestamp)/is', $info)) {
                // 日期及时间戳类型
                $value = date('Y-m-d H:i:s', $value);
            } elseif (preg_match('/(date)/is', $info)) {
                // 日期及时间戳类型
                $value = date('Y-m-d', $value);
            }
        }
        $bindName = $bindName ?: $key;
        $this->query->bind($bindName, $value, $bindType);
        return ':' . $bindName;
    }