Return a parameter as a formatted date string

@param  string $key
@param  string $format

@return string
18972
public function date($key, $format = "F j, Y")
    {
        if (is_numeric($this->_params[$key])) {
            return date($format, $this->_params[$key]);
        }

        return date($format, strtotime($this->_params[$key]));
    }
382993
public function getCreatedDateString($format = \DateTime::ISO8601)
    {
        $date = $this->getCreatedDate();

        if (empty($date)) {
            return null;
        }

        return $date->format($format);
    }
234796
protected function convertDateFormatToMoment($format)
    {
        $replacements = [
            'd' => 'DD',
            'D' => 'ddd',
            'j' => 'D',
            'l' => 'dddd',
            'N' => 'E',
            'S' => 'o',
            'w' => 'e',
            'z' => 'DDD',
            'W' => 'W',
            'F' => 'MMMM',
            'm' => 'MM',
            'M' => 'MMM',
            'n' => 'M',
            't' => '', // no equivalent
            'L' => '', // no equivalent
            'o' => 'YYYY',
            'Y' => 'YYYY',
            'y' => 'YY',
            'a' => 'a',
            'A' => 'A',
            'B' => '', // no equivalent
            'g' => 'h',
            'G' => 'H',
            'h' => 'hh',
            'H' => 'HH',
            'i' => 'mm',
            's' => 'ss',
            'u' => 'SSS',
            'e' => 'zz', // deprecated since version 1.6.0 of moment.js
            'I' => '', // no equivalent
            'O' => '', // no equivalent
            'P' => '', // no equivalent
            'T' => '', // no equivalent
            'Z' => '', // no equivalent
            'c' => '', // no equivalent
            'r' => '', // no equivalent
            'U' => 'X',
        ];

        foreach ($replacements as $from => $to) {
            $replacements['\\' . $from] = '[' . $from . ']';
        }

        return strtr($format, $replacements);
    }
534309
public function getDate($format = null)
    {
        $format = empty($format) ? $this->format : $format;

        return strftime($format, $this->ts);
    }
657034
public static function timeFormat($timestamp = null, $format = 'Y-m-d H:i:s')
    {
        if ($timestamp === null) {
            $timestamp = time();
        } elseif (empty($timestamp)) {
            return null;
        } else {
            $timestamp = intval($timestamp);
        }
        if (strncmp($format, 'php:', 4) === 0) {
            $format = substr($format, 4);
        }
        
        return date($format, $timestamp);
    }
507069
public static function date_format($format = null)
    {
        if (empty($format)) {
            $format = 'd-M-Y H:i:s O';
        }

        if (strpos($format, 'u') !== false) {
            $dt  = number_format(microtime(true), 6, '.', '');
            $dt .=  '.' . date_default_timezone_get();

            if ($date = date_create_from_format('U.u.e', $dt)) {
                return $date->format($format);
            }
        }

        return date($format);
    }
743180
public function format($format, $value)
    {
        switch ($format) {
            case 'date-time':
                return $this->formatDateTime($value);
            case 'date-time-http':
                return $this->formatDateTimeHttp($value);
            case 'date':
                return $this->formatDate($value);
            case 'time':
                return $this->formatTime($value);
            case 'timestamp':
                return $this->formatTimestamp($value);
            case 'boolean-string':
                return $this->formatBooleanAsString($value);
            default:
                return $value;
        }
    }
437191
public function format($format = '%d/%m/%Y')
    {
        if ($this->time == null) {
            return false;
        }
        
        return strftime($format, $this->time);
    }
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;
    }
677607
public static function date($format = "Y-m-d H:i:s", $time = null)
    {
        $time = ($time !== null ? $time : time());

        if (!is_numeric($time)) {
            $time = static::toUnix($time);
        }

        return date($format, $time);
    }
767929
static function get($key = 'all', $format = false)
    {
        if (isset(self::$stop[$key])){
            if ($format){
                return array(
                    'time' => sprintf('%0.8f s', self::$stop[$key]['time']),
                    'memory' => sprintf('%0.3f Mb', self::$stop[$key]['memory'] / 1048576),
                    'memory_max' => sprintf('%0.3f Mb', self::$stop[$key]['memory_max'] / 1048576),
                );
            }else{
                return self::$stop[$key];
            }
        }
        return null;
    }
462831
public function format($format = null)
    {
        if (!$format) {
            $format = $this->getFormat();
        }

        return parent::format($format ?: static::$toStringFormat);
    }
732450
public static function toDbFormat($format = "Y-m-d H:i:s", $timestamp = null)
    {
        if ($timestamp === null) {
            $timestamp = time();
        }
        return date($format, $timestamp);
    }
1218346
public function getFormattedDate($format, $startDate = true)
    {
        $date = $this->getEndDate();

        // Start date should be formatted?
        if ($startDate) {
            $date = $this->getStartDate();
        }

        // Unknown date or format is invalid?
        // Nothing to do
        if (null === $date || !Date::isValidDateFormat($format)) {
            return '';
        }

        return $date->format($format);
    }
633636
public function getPublishedDateString($format = \DateTime::ISO8601)
    {
        $date = $this->getPublishedDate();

        if (empty($date)) {
            return null;
        }

        return $date->format($format);
    }
592649
public function format($format)
    {
        $timestamp = mktime(
            $this->hour,
            $this->minute,
            $this->second,
            $this->month,
            $this->day,
            $this->year
        );
        return strftime($format, $timestamp);
    }
317199
public static function getDatePlaceholder(string $format) : string {
		$format = str_replace('Y', 'YYYY', $format);
		$format = str_replace('m', 'MM', $format);
		$format = str_replace('d', 'DD', $format);
		$format = str_replace('H', 'HH', $format);
		$format = str_replace('i', 'MM', $format);
		$format = str_replace('s', 'SS', $format);
		$format = str_replace('g', 'HH', $format);
		$format = str_replace('a', 'am', $format);
		$format = str_replace('u', '000000', $format);
		return $format;
	}