当前位置: 首页>>代码示例>>PHP>>正文


PHP DateTime::timestamp方法代码示例

本文整理汇总了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"));
 }
开发者ID:,项目名称:,代码行数:10,代码来源:

示例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;
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:13,代码来源:Provider.php

示例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;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:11,代码来源:IndexBuilder.php

示例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;
 }
开发者ID:vasiljok,项目名称:magento2,代码行数:16,代码来源:Collection.php

示例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;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:21,代码来源:Schedule.php

示例6: getTs

 /**
  * @return int
  */
 public function getTs()
 {
     return $this->dateTime->timestamp();
 }
开发者ID:tozwierz,项目名称:magento2_payupl,代码行数:7,代码来源:DataGetter.php

示例7: generateTimestamp

 /**
  * {@inheritdoc}
  */
 public function generateTimestamp()
 {
     return $this->_date->timestamp();
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:7,代码来源:Generator.php

示例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;
 }
开发者ID:tozwierz,项目名称:magento2_payupl,代码行数:9,代码来源:ExtOrderId.php


注:本文中的Magento\Framework\Stdlib\DateTime\DateTime::timestamp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。