Get date in HH-II-SS format, in server timezone
@param string|int|null $serverDatetimeOrTimestamp
@return string
170089
public function serverTime($serverDatetimeOrTimestamp = null) {
		return $this->format($serverDatetimeOrTimestamp, self::ISO_TIME_FORMAT, $this->serverTimezone);
	}
908204
public function fromMemcachedTimestamp($timestamp) : DateTime
    {
        $date = DateTime::createFromFormat('U', $timestamp);
        $date->setTimezone(new DateTimeZone(date_default_timezone_get()));

        return $date;
    }
306758
public static function shortDate($timestamp = null)
    {
        $l = self::getLocale();
        $cYear = date('Y');
        $date = date('Y-m-d', $timestamp);
        if (date('Y-m-d') == $date) {
            return I18n::get('Today %1', self::formatTime($timestamp));
        } elseif (date('Y-m-d', strtotime('yesterday')) == $date) {
            return I18n::get('Yesterday %1', self::formatTime($timestamp));
        } elseif (date('Y-m-d', strtotime('tomorrow')) == $date) {
            return I18n::get('Tomorrow %1', self::formatTime($timestamp));
        } elseif ($cYear == date('Y', $timestamp)) {
            return self::date(I18n::get('F j'), $timestamp);
        } else {
            return self::date(I18n::get('F Y'), $timestamp);
        }
    }
1130697
public function getTimestamp()
    {
        $timestamp = $this->runLast('date +"%Y%m%d%H%M%S"');
        $timestamp = trim($timestamp);
        $timestamp = preg_match('/^[0-9]{14}$/', $timestamp) ? $timestamp : date('YmdHis');

        return $timestamp;
    }
1177636
public static function formatTimestamp($timestamp, $format = self::DEFAULT_TIME_FORMAT, $timezone = self::DEFAULT_TIMEZONE)
    {
        $dateTime = new DateTime();
        $dateTime->setTimestamp($timestamp);
        $dateTime->setTimezone(new DateTimeZone($timezone));
        return $dateTime->format($format);
    }
630514
public static function getLocalTimestampFromUtcTimestamp( $utcTimestamp ) {
        $utcTimezone = new \DateTimeZone( 'UTC' );
        $localTimezone = new \DateTimeZone( date_default_timezone_get() );

        $utcDate = new \DateTime( null, $utcTimezone );
        $utcDate->setTimestamp( $utcTimestamp );
        $localDate = new \DateTime( $utcDate->format( 'Y-m-d H:i:s' ), $localTimezone );

        return $localDate->getTimestamp();
    }
931226
public static function createTimestamp($time = null, $format = 'Y-m-d H:i:s') {
        if ($time === null) {
            $time = time();
        }
        elseif (is_string($time)) {
            $time = strtotime($time);
        }

        return date($format, $time);
    }
183331
private String getFormattedTimestamp(int offset) {
        SimpleDateFormat df = new SimpleDateFormat(
                "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
        df.setTimeZone(TimeZone.getTimeZone("UTC"));

        if (overriddenDate != null) {
            return df.format(overriddenDate);
        } else {
            return df.format(getSignatureDate(offset));
        }
    }
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);
    }
1215930
static public String getSFTimeAsString(
      SFTime sft, int scale, SnowflakeDateTimeFormat timeFormatter)
  {
    return timeFormatter.format(sft, scale);
  }
1225547
public function setTimestamp($unixtimestamp) : \DateTime /*self invariant*/
    {
        if ($this->frozen) {
            throw new \RuntimeException(get_class($this) . ' is read-only, frozen.');
        }
        return parent::setTimestamp($unixtimestamp);
    }
941040
private function getCronTimestamp()
    {
        /* @var $version string e.g. "2.1.7" */
        $version = $this->productMetadata->getVersion();
        if (version_compare($version, '2.2.0') >= 0) {
            return $this->dateTime->gmtTimestamp();
        }
        return $this->timezone->scopeTimeStamp();
    }
1281296
public function getDay($timestamp = false)
    {
        if (!$timestamp) {
            $timestamp = $this->dateTime->getTimestamp();
        }

        return date('j', $timestamp);
    }
185904
public static function fromTimestamp($timestamp, DateTimeZone $dateTimeZone = null)
    {
        $base = new GregorianDateTime(
            date('Y-m-d H:i:s', $timestamp),
            self::checkForDateTimeZone($dateTimeZone)
        );

        return new DateTime($base);
    }
522929
public function getLastFeedExportDate()
    {
        $file = new SplFileInfo($this->config->getDefaultFeedFile());
        if (!$file->isFile()) {
            return null;
        }

        return new DateTime('@' . $file->getMTime());
    }
623727
public static function getdate($ts)
    {
        $datetime = self::getDateTime($ts);
        return array(
            'seconds'   => $datetime->format('s'),  // 00-59
            'minutes'   => $datetime->format('i'),  // 00-59
            'hours'     => $datetime->format('H'),  // 00-23
            'mday'      => (int) $datetime->format('d'),    // 1-31
            'wday'      => (int) $datetime->format('j'),    // 0-6
            'mon'       => (int) $datetime->format('n'),    // 1-12
            'year'      => $datetime->format('Y'),  // 4-digit year
            'yday'      => (int) $datetime->format('z'),    // 0-365
            'weekday'   => $datetime->format('l'),  // Sunday - Saturday
            'month'     => $datetime->format('F'),  // January - December
            '0'         => (int) $datetime->format('U'),
        );
    }
388043
public static function getTS($value = null)
	{
		if ($value === null)
		{
			return sfDateTimeToolkit::now();
		}
		else if ($value instanceof sfDate)
		{
			return $value->get();
		}
		else if (!is_numeric($value))
		{
			return strtotime($value);
		}
		else if (is_numeric($value))
		{
			return $value;
		}
		
		throw new sfDateTimeException(sprintf('A timestamp could not be retrieved from the value: %s', $value));
	}