将时间转换成字符串格式
@param null $time
@param string $format
@return string
343655
public static function format($time = null, $format = 'Y-m-d H:i:s') {
		if (!empty($time) && !is_numeric($time)) {
			$format = $time;
			$time = time();
		}
		if (is_null($time)) {
			$time = time();
		}
		return date($format, $time);
	}
836010
public function tzFormat($format, $tz = null)
    {
        if (isset($tz)) {
            $this->setTimezone(new DateTimeZone($tz));
        }

        return $this->format($format);
    }
1104828
public function createNormalized($format, $time)
    {
        return Date::createFromFormat($format, $time)->setTimezone($this->appTimezone);
    }
740802
public static function unixtimeFormat($time)
    {
        $v = time() - $time;
        $v = $v > 0 ? $v : 0;
        if ($v < 60) {
            $format = '刚刚';
        } else if ($v < 60 * 60) {
            $format = strval(floor($v / 60)) . '分钟前';
        } else if ($v < 60 * 60 * 24) {
            $format = strval(floor($v / 60 / 60)) . '小时前';
        } else {
            $format = strval(floor($v / 60 / 60 / 24)) . '天前';
        }
        return $format;
    }
116598
public function toString(string $format = null): string
    {
        if (isset($format)) {
            return (new DateTime('@0'))
                ->diff(new DateTime('@'.round($this->time, 0)))
                ->format($format);
        }
        return $this->__toString();
    }
1039210
public static function time( $format = false )
	{	
		$time = microtime( true ) - CCF_PROFILER_TME;
		
		if ( $format )
		{
			return CCStr::microtime( $time );
		}
		
		return $time;
	}
137017
private function formatTime(float $time, ?int $format = null): float
    {
        if (null === $format) {
            return round($time * 1000, 0);
        }

        return $time;
    }
457932
public function formatDate($format, \DateTime $date = null)
    {
        if (null === $date) {
            return null;
        }

        return $date->format($format);
    }
1054447
public function format(string $format): string
    {
        return CommonTime::inSeconds($this->seconds)->format($format);
    }
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);
    }
991340
public function create($format, $time)
    {
        return Date::createFromFormat($format, $time, $this->cachetTimezone)->setTimezone($this->appTimezone);
    }
31441
public function format($format = '')
  {
    if ( !empty($format) ){
      return $this->time->format($format);
    }
    else { 
      return $this->time->format('Y-m-d H:i:s');
    }
  }
333465
public function format($format = null) {
        if(is_null($format)) {
            $format = $this->getFormatter()->getDateTimeFormat();
        }
        return date($format, $this->getEpoch());
    }
712291
public static function generateRandomTime($format = 'H:i:s')
    {
        $dateTime = new DateTime();

        /*
         * Format si empty or is incorrect?
         * Nothing to do
         */
        if (empty($format) || $dateTime->format($format) === $format) {
            return null;
        }

        $hours = [];
        $minutes = [];
        $seconds = [];

        for ($i = 1; $i <= 23; ++$i) {
            $hours[] = $i;
        }

        for ($i = 1; $i <= 59; ++$i) {
            $minutes[] = $i;
        }

        for ($i = 1; $i <= 59; ++$i) {
            $seconds[] = $i;
        }

        // Prepare random time (hour, minute and second)
        $hour = $hours[array_rand($hours)];
        $minute = $minutes[array_rand($minutes)];
        $second = $seconds[array_rand($seconds)];

        return $dateTime
            ->setTime($hour, $minute, $second)
            ->format($format)
            ;
    }
462831
public function format($format = null)
    {
        if (!$format) {
            $format = $this->getFormat();
        }

        return parent::format($format ?: static::$toStringFormat);
    }
717374
public function date($date, $format = null)
    {
        if ($this->isEmptyDate($date)) {
            return '';
        }

        $isLocalizerFormat = in_array($format, [Localizer::SHORT, Localizer::LONG, Localizer::VERBOSE]);

        if ($format && !$isLocalizerFormat) {
            return $this->toDateTime($date)->format($format);
        }

        if (!$this->localizer) {
            return $this->toDateTime($date)->format('Y-m-d');
        }

        return $this->localizer->date($date, $format ?: Localizer::SHORT);
    }
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);
    }