This method is intend to act as format-dispatcher.

@param int    $timestamp The timestamp to format
@param string $format    The format to use for formatting input

@return mixed Result of request
559101
protected function formatDatetime($timestamp = 0, $format = '')
    {
        switch ($this->timeset) {
            case 1:
                // swatch date
            return $this->swatchDate($timestamp).' � '.$this->swatchTime($timestamp);
            break;
            case 2:
                // iso date
            return $this->unixTimestampToISOdatetime($timestamp);
            break;
            default:
                // default time
            return date($this->dateFilter($format, $timestamp), $timestamp);
            break;
        }
    }
326595
public function format(string $format, TimeZone $timeZone = null): string
    {
        if (null !== $timeZone) {
            return $timeZone->translate($this)->format($format);
        }

        return $this->dateTime->format($format);
    }
733176
protected function replaceDateTime($string, $timestamp)
    {
        foreach(static::DATE_FORMATS as $format)
        {
            $string = str_replace('{' . $format . '}', date($format, $timestamp), $string);
        }
        return $string;
    }
242438
public function setTimeFormat($format) {
        if (is_string($format)) {
            $this->timeFormatter = function ($t) use ($format) {
                return strftime($format, $t);
            };
        } else {
            $this->timeFormatter = $format;
        }

        return $this;
    }
491836
public function getCreatedTime($format = "")
    {
        $time = $this->created_time;
        if (!empty($format)) {
            $timestamp = strtotime($time);
            $time      = date($format, $timestamp);
        }

        return $time;
    }
1312634
public function format($format = null)
    {
        if (empty($format)) {
            $format = $this->defaultFormat;
        }
        return $this->formatDatetimeObject($format);
    }
839036
final public function format($format)
    {
        if(is_null($this->value)) {
            return null;
        } else {
            return $this->value->format($format);
        }
    }
711351
public static String timeStampToString(final Timestamp timestamp, final String format) {
        return dateToString(new Date(timestamp.getTime()), format);
    }
1321903
public static function DateFull($Timestamp, $Format = '') {
      if ($Timestamp === NULL)
         return T('Null Date', '-');

      // Was a mysqldatetime passed?
      if (!is_numeric($Timestamp)) {
         $Timestamp = self::ToTimestamp($Timestamp);
      }
         
      if (!$Timestamp)
         $Timestamp = time(); // return '&#160;'; Apr 22, 2009 - found a bug where "Draft Saved At X" returned a nbsp here instead of the formatted current time.
      $GmTimestamp = $Timestamp;

      $Now = time();
      
      // Alter the timestamp based on the user's hour offset
      $Session = Gdn::Session();
      if ($Session->UserID > 0) {
         $SecondsOffset = ($Session->User->HourOffset * 3600);
         $Timestamp += $SecondsOffset;
         $Now += $SecondsOffset;
      }

      $Html = FALSE;
      if (strcasecmp($Format, 'html') == 0) {
         $Format = '';
         $Html = TRUE;
      }
      
      $FullFormat = T('Date.DefaultDateTimeFormat', '%c');

      $Result = strftime($FullFormat, $Timestamp);

      if ($Html) {
         $Result = Wrap($Result, 'time', array('title' => strftime($FullFormat, $Timestamp), 'datetime' => gmdate('c', $GmTimestamp)));
      }
      return $Result;
   }
1219750
public function getMinute($timestamp = false)
    {
        if (!$timestamp) {
            $timestamp = $this->dateTime->getTimestamp();
        }

        return date('i', $timestamp);
    }
991340
public function create($format, $time)
    {
        return Date::createFromFormat($format, $time, $this->cachetTimezone)->setTimezone($this->appTimezone);
    }
803826
public static function timestampToGermanDateFormat(int $timestamp): string {
        $dateTime = new \DateTime();
        $dateTime->setTimestamp($timestamp);
        $format = $dateTime->format(DateTimeUtil::GERMAN_DATE_TIME_FORMAT);
        return $format;
    }
170565
protected function formatDateTime($format, $time = 'now', $timestamp = false)
    {
        if (empty($time)) {
            return;
        }

        if (false === $format) {
            return $time;
        } elseif (false !== strpos($format, '\\')) {
            return new $format($time);
        }

        if ($timestamp) {
            $dateTime = new DateTime();
            $dateTime->setTimestamp($time);
        } else {
            $dateTime = new DateTime($time);
        }

        return $dateTime->format($format);
    }
953343
public function format($format)
    {
        $function = $this->localFormatFunction ?: static::$formatFunction;

        if (!$function) {
            return $this->rawFormat($format);
        }

        if (is_string($function) && method_exists($this, $function)) {
            $function = [$this, $function];
        }

        return $function(...func_get_args());
    }
56260
public static function formatTime($timestamp = null, $style = 'short')
    {
        $property = $style . 'Time';
        return self::date(self::getLocale()->$property, $timestamp);
    }
808603
public function sayDateTime($timestamp, $format)
    {
        $this->addClientMethodCall('sayDateTime', $timestamp, $format, $this->validInterruptDigits);
        return $this;
    }
534163
public static function getFormatedDate($timestamp)
    {
        return MTimestampHelper::getDay($timestamp) . "." . MTimestampHelper::getMonth($timestamp) . "." . MTimestampHelper::getYear($timestamp);
    }