Prepare a date for array / JSON serialization.

@param  \DateTimeInterface $date
@return string
486204
protected function serializeDate(\DateTimeInterface $date)
    {
        if ($date instanceof Carbon && $this->timestamp_get_with_user_timezone) {
            $date->setTimezone($this->getAuthUserDateTimezone());
        }
        return $date->format($this->getDateFormat());
    }
551917
public function dateFormat($date, string $format = 'M d Y'): string
    {
        if ($date instanceof DateTime) {
            return $date->format($format);
        } elseif (is_int($date)) {
            return date($format, $date);
        }

        return date($format, strtotime($date));
    }
1169297
public function date($date=null)
    {
        if(is_null($date)) {
            $date = $this->created_at;
        }
        return String::date($date);
    }
1369320
public function serializeDateTimeImmutable(
        SerializationVisitorInterface $visitor,
        \DateTimeImmutable $date,
        array $type,
        SerializationContext $context
    ) {
        return $this->serializeDateTimeInterface($visitor, $date, $type, $context);
    }
281695
protected function frontendToInternal($date)
    {
        if (!$date) {
            return null;
        }
        $fromFormatter = $this->getFrontendFormatter();
        $toFormatter = $this->getInternalFormatter();
        $timestamp = $fromFormatter->parse($date);
        if ($timestamp === false) {
            return null;
        }
        return $toFormatter->format($timestamp) ?: null;
    }
347656
public static function format(\DateTimeInterface $date, $formatString)
    {
        $formater = new DateFormatter($formatString);
        return $formater->format($date);
    }
295888
protected static function makeDate($date = null)
    {
        if (is_string($date)) {
            $date = new DateTime($date);
        } elseif (is_numeric($date)) {
            $date = new DateTime('@'.$date);
        }

        return self::isDate($date) ? $date : null;
    }
1142388
protected function processDates() {
        if (is_array($this->data)) {
            foreach ($this->data as &$row) {
                if ($row[0] instanceof \DateTimeInterface)
                    $row[0] = new JsExpression("new Date(".($row[0]->getTimestamp()*1000).")");
                elseif ($this->xIsDate)
                    $row[0] = new JsExpression("new Date('$row[0]')");
            }
            return Json::encode($this->data, JSON_NUMERIC_CHECK);
        }
        return Json::encode($this->data);
    }
1095704
public function date($date, $format = null)
	{
		$datetime = DateTimeUtil::getDateTime($date);
        if (empty($format)) {
			$format = $this->cfg['date_format'];
		}
		if ($format == 'rel') {
			$date = DateTimeUtil::getRelTime($datetime);
		} else {
			$date = $datetime->format($format);
		}
		return $date;
	}
665949
public function format(\DateTimeInterface $date)
    {
        if ($date->getOffset() == 0) {
            return $date->format('YmdHis\Z');
        }
        return str_replace(':', '\'', $date->format('YmdHisP')) . '\'';
    }
411810
protected static function convertDateTime($date)
    {
        if (!$date) {
            return;
        }

        $date = new \DateTime($date);
        $date->setTimezone(new \DateTimeZone(date_default_timezone_get()));

        return $date->format(\DateTime::ISO8601);
    }
948568
public static function generate(\DateTime $date)
    {
        $list = array();
        $list[] = $date->format('ym');
        $list[] = $date->format('yd');
        $list[] = $date->format('my');
        $list[] = $date->format('md');
        $list[] = $date->format('dy');
        $list[] = $date->format('dm');

        return array_unique($list);
    }
979980
public function setDate(\DateTimeInterface $date)
    {
        $this->getDomElement()->nodeValue = $date->format(\DateTime::RFC3339);
        $this->setCachedProperty('content', $date);
    }
334851
protected function formatDatetimeUtc(DateTimeInterface $date, PropDefinition $propDefinition): string
    {
        return $this->formatDatetime($date, $propDefinition->set('timezone', 'UTC'));
    }
242506
public function toRegionTimeZone(DateTimeInterface $date = null)
    {
        $tz = $this->toRegionName($date);

        if ($tz === false) {
            if (Carbon::isStrictModeEnabled()) {
                throw new InvalidArgumentException('Unknown timezone for offset '.$this->getOffset($date ?: Carbon::now($this)).' seconds.');
            }

            return false;
        }

        return new static($tz);
    }
861342
public function translate($date): Date
    {
        $handle = Date::castFrom($date)->handle();
        $handle->setTimezone($this->timeZone);
        return new Date($handle);
    }
762189
public static function date($date){

		$Date = static::_utcZeroDateTime($date);

		if($Date === null){

			return $date;
		}

		return $Date->format('Y-m-d');
	}