Set created date

@param \DateTime|string $date
@param string|null $format
@return \Paragraph\Model\Paragraph\Structure\Content
435669
public function setCreated( $date, $format = null )
    {
        $this->created = $this->inputDate( $date, $format );
        return $this;
    }
833682
public function setDateFrom($date = null)
    {
        $date = $this->resolveCarbon($date);

        return $this->setDate($date->year, $date->month, $date->day);
    }
1312634
public function format($format = null)
    {
        if (empty($format)) {
            $format = $this->defaultFormat;
        }
        return $this->formatDatetimeObject($format);
    }
1292725
public function setDate($date = null)
    {
        if ($this->_date === null) {
            if ($date === null) {
                $date = date('r');
            } else if (is_int($date)) {
                $date = date('r', $date);
            } else if (is_string($date)) {
                $date = strtotime($date);
                if ($date === false || $date < 0) {
                    /**
                     * @see Zend_Mail_Exception
                     */
                    // require_once 'Zend/Mail/Exception.php';
                    throw new Zend_Mail_Exception('String representations of Date Header must be ' .
                                                  'strtotime()-compatible');
                }
                $date = date('r', $date);
            } else if ($date instanceof Zend_Date) {
                $date = $date->get(Zend_Date::RFC_2822);
            } else {
                /**
                 * @see Zend_Mail_Exception
                 */
                // require_once 'Zend/Mail/Exception.php';
                throw new Zend_Mail_Exception(__METHOD__ . ' only accepts UNIX timestamps, Zend_Date objects, ' .
                                              ' and strtotime()-compatible strings');
            }
            $this->_date = $date;
            $this->_storeHeader('Date', $date);
        } else {
            /**
             * @see Zend_Mail_Exception
             */
            // require_once 'Zend/Mail/Exception.php';
            throw new Zend_Mail_Exception('Date Header set twice');
        }
        return $this;
    }
34560
public function setPublishedTo( $date, $format = null )
    {
        $this->publishedTo = empty( $date ) ? null : $this->inputDate( $date, $format );
        return $this;
    }
166149
protected function date_format($date)
    {
        if (empty($date)) {
            return null;
        }

        if (!is_object($date) || !is_a($date, 'DateTime')) {
            try {
                $timestamp = rcube_utils::strtotime($date);
                $date      = new DateTime("@".$timestamp);
            }
            catch (Exception $e) {
                return null;
            }
        }

        return $date->format('d-M-Y H:i:s O');
    }
804358
public function getRequestDate($format = null)
    {
        $node = $this->getFirst('//epp:epp/epp:response/epp:resData/domain:trnData/domain:reDate');
        if ($format === null) {
            return $node->nodeValue;
        }

        return date_create_from_format($format, $node->nodeValue);
    }
206354
public static function fromFormat(string $format, string $dateString) : Date
    {
        return self::fromNative(\DateTimeImmutable::createFromFormat($format, $dateString));
    }
268729
public function setDateStart( $date )
	{
		if ( $date === $this->getDateStart() ) { return; }

		$this->_checkDateFormat($date);

		$this->_values['start'] = ( $date !== null ? (string) $date : null );
		$this->setModified();
	}
317948
public static function dataJuliano($date, $format = 'Y-m-d')
    {
        $date = ($date instanceof Carbon) ? $date : Carbon::createFromFormat($format, $date);
        $dateDiff = $date->copy()->day(31)->month(12)->subYear(1)->diffInDays($date);
        return $dateDiff . mb_substr($date->year, -1);
    }
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;
	}
58603
public static function createFromFormat($format, $time, $timezone = null)
    {
        $parent = parent::createFromFormat($format, $time);

        if (empty($parent)) {
            throw new TypeException('Could not create Date from the given format');
        }

        $timestamp = $parent->getTimestamp();
        $date = new self();
        $date->setTimestamp($timestamp);

        return $date;
    }
696386
public function format($date, $format = 'iso8601', $validate = true)
    {
        $result = null;
        try {
            if ($validate) {
                $format = $this->validateFormat($format);
            }
            $result = $this->parse($date)->format($format);
        } catch (\Exception $e) {
        }

        return $result;
    }
1222286
public function prettyDate($date, $format = null)
    {
        if (is_string($date)) {
            $date = new \DateTime($date);
        }

        if (null !== $format) {
            return $this->dateFormatter->prettyDate($date, $format);
        }

        return $this->dateFormatter->prettyDate($date);
    }
23903
public static function validateDateBasic($date, $format = self::FORMAT): bool
    {
        $object = DateTime::createFromFormat($format, $date);

        return $object && $object->format($format) === $date;
    }
1338805
public static function sql2date($date, $format = '%d/%m/%Y')
    {
        if (empty($date)) {
            return null;
        }
        $dt = new self();
        $dt->set_date($date);
        
        return $dt->format($format);
    }
652836
protected static function _strftime($format, $date) {
		$format = strftime($format, $date);
		$encoding = Configure::read('App.encoding');

		if (!empty($encoding) && $encoding === 'UTF-8') {
			$valid = mb_check_encoding($format, $encoding);
			if (!$valid) {
				$format = utf8_encode($format);
			}
		}
		return $format;
	}