Returns the resulting time

@param int|null $format

@return float
190186
public function getTime(?int $format = null): float
    {
        $result = $this->endTime - $this->startTime;

        return $this->formatTime($result, $format);
    }
1163557
public static function timestamp($time = null): int
    {
        if ($time instanceof \DateTime) {
            return $time->format('U');
        }

        $time = time();

        if ($time !== null) {
            $time = is_numeric($time) ? (int) $time : strtotime($time);
        }

        return $time;
    }
439469
public function getLongitude(string $format = self::FORMAT_DECIMAL)
    {
        if (self::FORMAT_DMS === $format) {
            return $this->toDms($this->longitude, self::LONGITUDE);
        }

        return $this->longitude;
    }
1195047
public function timeAgo($time = null, $format = null) {
		if (empty($time)) {
			$time = time();
		}
		if (empty($format)) {
			$format = '%x %X';
		}

		$result = $this->Html->tag(
			'time',
			$this->Time->i18nFormat($time, $format),
			[
				'data-toggle' => 'timeago',
				'datetime' => date('c', $this->Time->fromString($time)),
				'class' => 'help'
			]
		);

		return $result;
	}
333465
public function format($format = null) {
        if(is_null($format)) {
            $format = $this->getFormatter()->getDateTimeFormat();
        }
        return date($format, $this->getEpoch());
    }
1198926
public static function time(string $time = 'now', string $format = null): \DateTimeInterface {
        $timezone = new \DateTimeZone('utc');

        if (is_null($format)) {
            $date = new \DateTime($time, $timezone);
        } else {
            $date = \DateTime::createFromFormat($format, $time, $timezone);
        }

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

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

        return $date->format($format);
    }
283977
public function getDateSunday($format = 'Y-m-d')
    {
        $weekDay = 7 - $this->format('N');
        $time = $this->getTimestamp();
        if ($weekDay) {
            $time += $weekDay * 24 * 3600;
        }
        return date($format, $time);
    }
620180
public function read(string $format = null) : string
    {
        $input = array_shift($this->stack);
        if (isset($format, $input)) {
            $input = sprintf($format, $input);
        }
        return $input ?? '';
    }
92525
public function getAsDate($column, $format = null, $default = false)
  {
    $v = $this->get($column, $default);

    return $v ? new DateTime($v, null, $format) : $default;
  }
535962
public function format($format)
    {
        $format = preg_replace_callback('/(?<!\\\\)[DlFM]/', array($this, '_translate'), $format);
        return $this->_date->format($format);
    }
334398
public function getYear($format = self::YEAR_FORMAT_LONG)
    {
        if ($this->isHollow()) {
            return 0;
        }

        return (int) $this->format($format);
    }
177430
public function getShippingCompletedTime($format = '')
    {
        $time = $this->shipping_completed_time;
        if (!empty($format)) {
            $timestamp = strtotime($time);
            $time      = date($format, $timestamp);
        }

        return $time;
    }
375643
public function getUpdateDate($format = null)
    {
        $node = $this->getFirst('//epp:epp/epp:response/epp:resData/host:infData/host:upDate');
        if ($node === null) {
            return null;
        }

        if ($format === null) {
            return $node->nodeValue;
        }

        return date_create_from_format($format, $node->nodeValue);
    }
710825
public function toString($format = null) {
        // If no format is defined, use the one specified in the current class
        if (!isset($format)) {
            $format = self::DATETIME_FORMAT;
        }

        return $this->_dateTime->format($format) . '.' . self::_formatMilliseconds($this->_milliseconds);
    }
444117
public function format(string $format = null, int $precision = null)
    {
        if (null === $format) {
            return Formatter::getIntelligentFormat($this->microsecond, $precision);
        }

        $unit = Mapper::getUnitFromAbbreviation($format);
        $value = $this->microsecond / Mapper::getFactor($unit);

        return Formatter::valueAndUnitToString($value, $unit, $precision);
    }
1105914
static public function datetime($value=null, $format=null)
    {
        $value = static::toUnixtime($value);
        if (!$format) {
            $value = strftime('%Y-%m-%d %H:%M:%S', $value);
        } else {
            if (strpos($format, '%') === false) {
                $format = preg_replace('/([a-z])/i', '%\\1', $format);
            }
            $value = strftime($format, $value);
        }
        return $value;
    }