Set the timestamp of the message generation
@var int|\DateTime $timestamp UNIX Timestamp (as generated by time() or strtotime()) or a php DateTime object
@return Bsd
426863
public function setTimestamp($timestamp)
    {
        if (!$timestamp instanceof \DateTime) {
            $date = new \DateTime();
            $date->setTimestamp($timestamp);
        } else {
            $date = $timestamp;
        }
        $this->header['TIMESTAMP'] = $date->format('M d H:i:s');
        return $this;
    }
137739
public function putDate(int $timestamp = null): self
    {
        if (null === $timestamp) {
            $date = gmdate('D, d M Y H:i:s');
        } else {
            $date = gmdate('D, d M Y H:i:s', $timestamp);
        }

        $this->put('Date', $date . ' GMT');
        return $this;
    }
205640
public function setSendTimestamp(\AgentSIB\Diadoc\Api\Proto\Timestamp $value = null)
    {
        $this->SendTimestamp = $value;
    }
1318156
public static function ToDate($Timestamp = '') {
      if ($Timestamp == '')
         $Timestamp = time();
      elseif (!is_numeric($Timestamp))
         $Timestamp = self::ToTimestamp($Timestamp);

      return date('Y-m-d', $Timestamp);
   }
570791
public function setTimestamp($timestamp)
    {
        try {
            $this->getDateObject()->setTimestamp($timestamp);
        } catch (\Exception $e) {
            throw new DateTimeObjectException($e->getMessage());
        }

        return $this;
    }
773093
private function getTimestamp(?int $timestamp): int
    {
        $timestamp = $timestamp ?? time();
        Assertion::greaterOrEqualThan($timestamp, 0, 'Timestamp must be at least 0.');

        return $timestamp;
    }
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);
    }
510525
public function fromTimestamp($timestamp, $timezone = 'UTC')
    {
        // [TODO] use DateTime object for parse timestamp
        $oldTz = date_default_timezone_get();
        date_default_timezone_set($timezone);
        $timestamp = mktime(date('H', $timestamp), date('i', $timestamp), date('s', $timestamp), date('n', $timestamp), date('j', $timestamp), date('Y', $timestamp));
        date_default_timezone_set('UTC');
        $utcDT = gmdate('c', $timestamp);
        $dateArray = getdate(strtotime(gmdate('c', $timestamp)));
        date_default_timezone_set($oldTz);
        unset($dateArray[0]);

        $this->from($dateArray, 'en_US', null, $timezone);

        return $this;
    }
585229
public function setTimestamp($timestamp = null)
    {
        $this->timestamp = $timestamp;
        if ($timestamp === null) {
            $this->timestamp = new Timestamp();
        }
        return $this;
    }
618557
public function setTimestamp($unixtimestamp) {
		$diff = $unixtimestamp - $this->getTimestamp();
		$days = floor($diff / 86400);
		$seconds = $diff - $days * 86400;
		$timezone = $this->getTimezone();
		$this->setTimezone('UTC');
		parent::modify("$days days $seconds seconds");
		$this->setTimezone($timezone);
		return $this;
	}
519882
public function convertTime($timestamp)
    {
        $ts = new BigNumber($timestamp, 20);
        $ts->subtract('122192928000000000');
        $ts->divide('10000000.0');
        $ts->round();

        return $ts->getValue();
    }
420561
protected function generateEtag(\DateTime $timeStamp)
    {
        $user = $this->securityService->findGitUser();
        $userString = '';
        if (null !== $user) {
            $userString = $user->getGitUserName();
        }

        return md5($timeStamp->getTimestamp() . $userString);
    }
708199
public static function createFromDOSTimestamp($timestamp, $timezone = null)
    {
        $year          = (($timestamp >> 25) & 0x7f) + 1980;
        $mon           = ($timestamp >> 21) & 0x0f;
        $mday          = ($timestamp >> 16) & 0x1f;
        $hours         = ($timestamp >> 11) & 0x1f;
        $minutes       = ($timestamp >> 5) & 0x3f;
        $seconds       = 2 * ($timestamp & 0x1f);
        $unixTimestamp = mktime($hours, $minutes, $seconds, $mon, $mday, $year);

        return static::createFromTimestamp($unixTimestamp, $timezone);
    }
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);
    }
973003
public function getHour($timestamp = false)
    {
        if (!$timestamp) {
            $timestamp = $this->dateTime->getTimestamp();
        }

        return date('G', $timestamp);
    }
345754
protected function toDateTime($timestamp)
    {
        if (is_numeric($timestamp)) {
            // Unix timestamp.
            $result = new DateTime();
            $result->setTimestamp($timestamp);
        } else {
            // Formatted timestamp, e.g. yyyy-mm-dd hh:mm:ss.
            $result = DateTime::createFromFormat(static::$timestampFormat, $timestamp);
        }
        return $result;
    }
254193
public static function create(float $timestamp = null): \DateTime
    {
        $date = static::format($timestamp);
        return new \DateTime($date);
    }