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


PHP TimezoneInterface::date方法代码示例

本文整理汇总了PHP中Magento\Framework\Stdlib\DateTime\TimezoneInterface::date方法的典型用法代码示例。如果您正苦于以下问题:PHP TimezoneInterface::date方法的具体用法?PHP TimezoneInterface::date怎么用?PHP TimezoneInterface::date使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Framework\Stdlib\DateTime\TimezoneInterface的用法示例。


在下文中一共展示了TimezoneInterface::date方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processCalendarDetails

 public function processCalendarDetails($carrierRate, $carrierGroupDetail)
 {
     $calendarDetails = parent::processCalendarDetails($carrierRate, $carrierGroupDetail);
     //transform for current locale
     $calendarDetails['start'] = $this->localeDate->date($calendarDetails['start'], null, true)->getTimestamp();
     return $calendarDetails;
 }
开发者ID:shipperhq,项目名称:module-common,代码行数:7,代码来源:Calendar.php

示例2: execute

 /**
  * Refresh sales order report statistics for last day
  *
  * @return void
  */
 public function execute()
 {
     $this->localeResolver->emulate(0);
     $currentDate = $this->localeDate->date();
     $date = $currentDate->sub(new \DateInterval('PT25H'));
     $this->orderFactory->create()->aggregate($date);
     $this->localeResolver->revert();
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:13,代码来源:AggregateSalesReportOrderData.php

示例3: execute

 /**
  * Refresh sales refunded report statistics for last day
  *
  * @return void
  */
 public function execute()
 {
     $this->localeResolver->emulate(0);
     $currentDate = $this->localeDate->date();
     $date = $currentDate->subHour(25);
     $this->refundedFactory->create()->aggregate($date);
     $this->localeResolver->revert();
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:13,代码来源:AggregateSalesReportRefundedData.php

示例4: execute

 /**
  * Refresh sales coupons report statistics for last day
  *
  * @return $this
  */
 public function execute()
 {
     $this->_localeResolver->emulate(0);
     $currentDate = $this->_localeDate->date();
     $date = $currentDate->modify('-25 hours');
     $this->_reportRule->aggregate($date);
     $this->_localeResolver->revert();
     return $this;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:14,代码来源:AggregateSalesReportCouponsData.php

示例5: invoke

 /**
  * Refresh sales tax report statistics for last day
  *
  * @return $this
  */
 public function invoke()
 {
     $this->localeResolver->emulate(0);
     $currentDate = $this->localeDate->date();
     $date = $currentDate->modify('-25 hours');
     /** @var $reportTax \Magento\Tax\Model\ResourceModel\Report\Tax */
     $reportTax = $this->reportTaxFactory->create();
     $reportTax->aggregate($date);
     $this->localeResolver->revert();
     return $this;
 }
开发者ID:IlyaGluschenko,项目名称:protection,代码行数:16,代码来源:AggregateSalesReportTaxData.php

示例6: cleanup

 /**
  * Delete completed records older then 30 days from provided table.
  *
  * @param $tableName
  *
  * @return \Exception|int
  */
 public function cleanup($tableName)
 {
     try {
         $interval = new \DateInterval('P30D');
         $date = $this->localeDate->date()->sub($interval)->format('Y-m-d H:i:s');
         $conn = $this->getConnection();
         $num = $conn->delete($tableName, ['created_at < ?' => $date]);
         return $num;
     } catch (\Exception $e) {
         return $e->getMessage();
     }
 }
开发者ID:dotmailer,项目名称:dotmailer-magento2-extension,代码行数:19,代码来源:Importer.php

示例7: getProductsCollection

 /**
  * @param int $storeId
  * @return \Magento\Catalog\Model\ResourceModel\Product\Collection
  */
 public function getProductsCollection($storeId)
 {
     /** @var $product \Magento\Catalog\Model\Product */
     $product = $this->productFactory->create();
     $todayStartOfDayDate = $this->localeDate->date()->setTime(0, 0)->format('Y-m-d H:i:s');
     $todayEndOfDayDate = $this->localeDate->date()->setTime(23, 59, 59)->format('Y-m-d H:i:s');
     /** @var $products \Magento\Catalog\Model\ResourceModel\Product\Collection */
     $products = $product->getResourceCollection();
     $products->setStoreId($storeId);
     $products->addStoreFilter()->addAttributeToFilter('news_from_date', ['or' => [0 => ['date' => true, 'to' => $todayEndOfDayDate], 1 => ['is' => new \Zend_Db_Expr('null')]]], 'left')->addAttributeToFilter('news_to_date', ['or' => [0 => ['date' => true, 'from' => $todayStartOfDayDate], 1 => ['is' => new \Zend_Db_Expr('null')]]], 'left')->addAttributeToFilter([['attribute' => 'news_from_date', 'is' => new \Zend_Db_Expr('not null')], ['attribute' => 'news_to_date', 'is' => new \Zend_Db_Expr('not null')]])->addAttributeToSort('news_from_date', 'desc')->addAttributeToSelect(['name', 'short_description', 'description'], 'inner')->addAttributeToSelect(['price', 'special_price', 'special_from_date', 'special_to_date', 'msrp_display_actual_price_type', 'msrp', 'thumbnail'], 'left')->applyFrontendPriceLimitations();
     $products->setVisibility($this->visibility->getVisibleInCatalogIds());
     return $products;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:17,代码来源:NewProducts.php

示例8: prepareDataSource

    /**
     * @param array $dataSource
     * @return array
     */
    public function prepareDataSource(array $dataSource)
    {
        if (isset($dataSource['data']['items'])) {
            foreach ($dataSource['data']['items'] as & $item) {
                if (isset($item[$this->getData('name')])) {
                    $date = $this->timezone->date(new \DateTime($item[$this->getData('name')]));
                    $item[$this->getData('name')] = $date->format('Y-m-d H:i:s');
                }
            }
        }

        return $dataSource;
    }
开发者ID:razbakov,项目名称:magento2,代码行数:17,代码来源:Date.php

示例9: getValue

 /**
  * Retrieve attribute value
  *
  * @param \Magento\Framework\Object $object
  * @return mixed
  */
 public function getValue(\Magento\Framework\Object $object)
 {
     $data = '';
     $value = parent::getValue($object);
     $format = $this->_localeDate->getDateFormat(\Magento\Framework\Stdlib\DateTime\TimezoneInterface::FORMAT_TYPE_MEDIUM);
     if ($value) {
         try {
             $data = $this->_localeDate->date($value, \Zend_Date::ISO_8601, null, false)->toString($format);
         } catch (\Exception $e) {
             $data = $this->_localeDate->date($value, null, null, false)->toString($format);
         }
     }
     return $data;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:20,代码来源:Datetime.php

示例10: _convertFlatToRecursive

 /**
  * Set specified data to current rule.
  * Set conditions and actions recursively.
  * Convert dates into \Zend_Date.
  *
  * @param array $data
  * @return array
  */
 protected function _convertFlatToRecursive(array $data)
 {
     $arr = array();
     foreach ($data as $key => $value) {
         if (($key === 'conditions' || $key === 'actions') && is_array($value)) {
             foreach ($value as $id => $data) {
                 $path = explode('--', $id);
                 $node =& $arr;
                 for ($i = 0, $l = sizeof($path); $i < $l; $i++) {
                     if (!isset($node[$key][$path[$i]])) {
                         $node[$key][$path[$i]] = array();
                     }
                     $node =& $node[$key][$path[$i]];
                 }
                 foreach ($data as $k => $v) {
                     $node[$k] = $v;
                 }
             }
         } else {
             /**
              * Convert dates into \Zend_Date
              */
             if (in_array($key, array('from_date', 'to_date')) && $value) {
                 $value = $this->_localeDate->date($value, \Magento\Framework\Stdlib\DateTime::DATE_INTERNAL_FORMAT, null, false);
             }
             $this->setData($key, $value);
         }
     }
     return $arr;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:38,代码来源:AbstractModel.php

示例11: _validateExpDate

 /**
  * @param string $expYear
  * @param string $expMonth
  * @return bool
  */
 protected function _validateExpDate($expYear, $expMonth)
 {
     $date = $this->_localeDate->date();
     if (!$expYear || !$expMonth || $date->compareYear($expYear) == 1 || $date->compareYear($expYear) == 0 && $date->compareMonth($expMonth) == 1) {
         return false;
     }
     return true;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:13,代码来源:Cc.php

示例12: aggregateSalesReportCouponsData

 /**
  * Refresh sales coupons report statistics for last day
  *
  * @return $this
  */
 public function aggregateSalesReportCouponsData()
 {
     $this->_localeResolver->emulate(0);
     $currentDate = $this->_localeDate->date();
     $date = $currentDate->subHour(25);
     $this->_reportRule->aggregate($date);
     $this->_localeResolver->revert();
     return $this;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:14,代码来源:Observer.php

示例13: aggregateSalesReportBestsellersData

 /**
  * Refresh bestsellers report statistics for last day
  *
  * @param \Magento\Cron\Model\Schedule $schedule
  * @return $this
  */
 public function aggregateSalesReportBestsellersData($schedule)
 {
     $this->_localeResolver->emulate(0);
     $currentDate = $this->_localeDate->date();
     $date = $currentDate->subHour(25);
     $this->_bestsellersFactory->create()->aggregate($date);
     $this->_localeResolver->revert();
     return $this;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:15,代码来源:Observer.php

示例14: getValue

 /**
  * @return array
  */
 public function getValue()
 {
     if ($this->getInputType() == 'date' && !$this->getIsValueParsed()) {
         // date format intentionally hard-coded
         $this->setValue($this->_localeDate->date($this->getData('value'), \Magento\Framework\Stdlib\DateTime::DATE_INTERNAL_FORMAT, null, false)->toString(\Magento\Framework\Stdlib\DateTime::DATE_INTERNAL_FORMAT));
         $this->setIsValueParsed(true);
     }
     return $this->getData('value');
 }
开发者ID:aiesh,项目名称:magento2,代码行数:12,代码来源:AbstractCondition.php

示例15: aggregateSalesReportTaxData

 /**
  * Refresh sales tax report statistics for last day
  *
  * @param \Magento\Cron\Model\Schedule $schedule
  * @return $this
  */
 public function aggregateSalesReportTaxData($schedule)
 {
     $this->_localeResolver->emulate(0);
     $currentDate = $this->_localeDate->date();
     $date = $currentDate->subHour(25);
     /** @var $reportTax \Magento\Tax\Model\Resource\Report\Tax */
     $reportTax = $this->_reportTaxFactory->create();
     $reportTax->aggregate($date);
     $this->_localeResolver->revert();
     return $this;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:17,代码来源:Observer.php


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