本文整理汇总了PHP中Magento\Framework\Stdlib\DateTime\DateTime::timestamp方法的典型用法代码示例。如果您正苦于以下问题:PHP DateTime::timestamp方法的具体用法?PHP DateTime::timestamp怎么用?PHP DateTime::timestamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Stdlib\DateTime\DateTime
的用法示例。
在下文中一共展示了DateTime::timestamp方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testTimestamp
public function testTimestamp()
{
$time = time();
$this->localeDate->expects($this->at(0))->method('date')->with(1404377188)->will($this->returnValue($this->date));
$this->localeDate->expects($this->at(1))->method('date')->with($time)->will($this->returnValue($this->date));
$this->localeDate->expects($this->at(2))->method('date')->with(strtotime("10 September 2000"))->will($this->returnValue($this->date));
$this->assertSame(1403806949, $this->dateTime->timestamp());
$this->assertSame(1403806949, $this->dateTime->timestamp($time));
$this->assertSame(1403806949, $this->dateTime->timestamp("10 September 2000"));
}
示例2: validateConsumer
/**
* {@inheritdoc}
*/
public function validateConsumer($consumer)
{
// Must use consumer within expiration period.
$consumerTS = strtotime($consumer->getCreatedAt());
$expiry = $this->_dataHelper->getConsumerExpirationPeriod();
if ($this->_date->timestamp() - $consumerTS > $expiry) {
throw new \Magento\Framework\Oauth\Exception('Consumer key has expired');
}
return true;
}
示例3: roundTime
/**
* @param int $timeStamp
* @return int
*/
private function roundTime($timeStamp)
{
if (is_numeric($timeStamp) && $timeStamp != 0) {
$timeStamp = $this->dateTime->timestamp($this->dateTime->date('Y-m-d 00:00:00', $timeStamp));
}
return $timeStamp;
}
示例4: _afterLoadData
/**
* @return $this
*/
protected function _afterLoadData()
{
parent::_afterLoadData();
if ($this->_addDaysInWishlist) {
$gmtOffset = (int) $this->_date->getGmtOffset();
$nowTimestamp = $this->_date->timestamp();
foreach ($this as $wishlistItem) {
$wishlistItemTimestamp = $this->_date->timestamp($wishlistItem->getAddedAt());
$wishlistItem->setDaysInWishlist((int) (($nowTimestamp - $gmtOffset - $wishlistItemTimestamp) / 24 / 60 / 60));
}
}
return $this;
}
示例5: trySchedule
/**
* Checks the observer's cron expression against time
*
* Supports $this->setCronExpr('* 0-5,10-59/5 2-10,15-25 january-june/2 mon-fri')
*
* @return bool
*/
public function trySchedule()
{
$time = $this->getScheduledAt();
$e = $this->getCronExprArr();
if (!$e || !$time) {
return false;
}
if (!is_numeric($time)) {
$time = strtotime($time);
}
$d = getdate($this->_date->timestamp($time));
$match = $this->matchCronExpression($e[0], $d['minutes']) && $this->matchCronExpression($e[1], $d['hours']) && $this->matchCronExpression($e[2], $d['mday']) && $this->matchCronExpression($e[3], $d['mon']) && $this->matchCronExpression($e[4], $d['wday']);
return $match;
}
示例6: getTs
/**
* @return int
*/
public function getTs()
{
return $this->dateTime->timestamp();
}
示例7: generateTimestamp
/**
* {@inheritdoc}
*/
public function generateTimestamp()
{
return $this->_date->timestamp();
}
示例8: generate
/**
* @param \Magento\Sales\Model\Order $order
* @return string
*/
public function generate(\Magento\Sales\Model\Order $order)
{
$try = $this->transactionResource->getLastTryByOrderId($order->getId()) + 1;
return $order->getIncrementId() . ':' . $this->dateTime->timestamp() . ':' . $try;
}