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


PHP Zend_Date::setTimestamp方法代码示例

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


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

示例1: setDateFromTimestamp

 /**
  * @param $timestamp
  */
 protected function setDateFromTimestamp($timestamp)
 {
     if (\Pimcore\Config::getFlag("useZendDate")) {
         $this->date = new \Pimcore\Date($timestamp);
     } else {
         $this->date = new \Carbon\Carbon();
         $this->date->setTimestamp($timestamp);
     }
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:12,代码来源:Date.php

示例2: dateProvider

 /**
  * @return array
  *
  * @author Luke Rodgers <lukerodgers90@gmail.com>
  */
 public function dateProvider()
 {
     $rowA = new Varien_Object(array('field' => '2015-01-06'));
     $rowB = new Varien_Object(array('field' => '2015-01-08'));
     $rowC = new Varien_Object(array('field' => '2015-01-10'));
     $rowD = new Varien_Object();
     $timestamp1 = new Zend_Date();
     $timestamp1->setTimestamp(strtotime('2015-01-07'));
     $timestamp2 = new Zend_Date();
     $timestamp2->setTimestamp(strtotime('2015-01-09'));
     return array(array(array($rowA, $rowB, $rowC, $rowD), array('field' => array(new Varien_Object(array('value' => array('date' => true, 'from' => $timestamp1, 'to' => $timestamp2))))), array($rowB)));
 }
开发者ID:r8-forks,项目名称:CollectionNoDb,代码行数:17,代码来源:FiltererTest.php

示例3: testShouldReturnTrueWhenCheckNotExpiredPayment

 public function testShouldReturnTrueWhenCheckNotExpiredPayment()
 {
     //GIVEN
     $oPurchase = AM_Model_Db_Table_Abstract::factory('purchase')->findOneBy(array('id' => 1));
     $oDate = new Zend_Date();
     $oDate->setTimestamp(time() + 3600000);
     $oPurchase->expires_date = $oDate->toString('Y-m-d H:i:s');
     $oPurchase->save();
     //WHEN
     $bResult = $oPurchase->isExpired();
     //THEN
     $this->assertFalse($bResult);
 }
开发者ID:pansot2,项目名称:PadCMS-backend,代码行数:13,代码来源:PurchaseIsExpiredTest.php.php

示例4: testSetTimestamp2

 /**
  * Test for setTimestamp
  */
 public function testSetTimestamp2()
 {
     try {
         $locale = new Zend_Locale('de_AT');
         $date = new Zend_Date(0, null, $locale);
         $result = $date->setTimestamp('notimestamp');
         $this->Fail("exception expected");
     } catch (Zend_Date_Exception $e) {
         // success
     }
 }
开发者ID:jsnshrmn,项目名称:Suma,代码行数:14,代码来源:DateTest.php

示例5: _getMainSection

 protected function _getMainSection()
 {
     try {
         $list = array();
         $markedRows = $this->_controller->getMarkedRows();
         #Sitengine_Debug::print_r($markedRows);
         $dir = $this->_controller->getTempDir();
         if (is_dir($dir)) {
             $dirIterator = new DirectoryIterator($dir);
             $date = new Zend_Date(null, Zend_Date::ISO_8601, $this->_controller->getLocale());
             $date->setTimezone($this->_controller->getPreferences()->getTimezone());
             foreach ($dirIterator as $count => $file) {
                 if (is_file($dir . '/' . $file->getFilename()) && !preg_match('/^(\\.|\\.\\.|\\.DS_Store)$/', $file->getFilename())) {
                     $filename = $file->getFilename();
                     $id = 'item' . $count;
                     $size = round($file->getSize() / 1024 / 1024, 1);
                     if ($size >= 1) {
                         $size .= 'MB';
                     } else {
                         $size = round($file->getSize() / 1024, 0) . 'KB';
                     }
                     $date->setTimestamp($file->getCTime());
                     $udate = $date->get(Zend_Date::DATE_FULL) . ' ';
                     $udate .= $date->get(Zend_Date::TIME_FULL);
                     $p = 'SELECTROWITEM' . $id;
                     $s = sizeof($markedRows) && isset($markedRows[$id]) ? $this->_controller->getRequest()->getPost($p) : 0;
                     $e = new Sitengine_Form_Element($p, 1);
                     $e->setClass('listformCheckbox');
                     $checkbox = $e->getCheckbox($s);
                     $checkbox .= Sitengine_Form_Element::getHidden('FILENAME' . $id, $filename);
                     $n = 'type';
                     $p = 'UPDATEROWITEM' . $n . 'ITEMID' . $id;
                     $h = 'UPDATEROWITEMCURRENT' . $n . 'ITEMID' . $id;
                     $v = sizeof($markedRows) && isset($markedRows[$id]) ? $this->_controller->getRequest()->getPost($p) : Sitengine_Proto_Backend_Goodies_Shouldies_Controller::VALUE_NONESELECTED;
                     $e = new Sitengine_Form_Element($p, $v);
                     $e->setClass('listformSelect');
                     $type = $e->getSelect($this->_controller->getTranslate()->translateGroup('fieldValsType')->toArray());
                     $type .= Sitengine_Form_Element::getHidden($h, Sitengine_Proto_Backend_Goodies_Shouldies_Controller::VALUE_NONESELECTED);
                     $args = array(Sitengine_Env::PARAM_CONTROLLER => 'shouldiesUploads', Sitengine_Env::PARAM_FILE => $filename);
                     $uriDownload = $this->_controller->getFrontController()->getProtoPackage()->getDownloadHandler();
                     $uriDownload .= Sitengine_Controller_Request_Http::makeNameValueQuery($args);
                     $list[] = array('id' => $id, 'name' => $filename, 'size' => $size, 'udate' => $udate, 'rowSelectCheckbox' => $checkbox, 'type' => $type, 'uriDownload' => $uriDownload, 'isMarked' => isset($markedRows[$id]) ? $markedRows[$id] : 0);
                 }
             }
         }
         #Sitengine_Debug::print_r($list);
         ########################################################################
         #### PAGER DATA
         #######################################################################
         $pagerData = array('hiddens' => '', 'currPageInput' => '', 'currPage' => 1, 'nextPage' => 1, 'prevPage' => 1, 'numPages' => 1, 'numItems' => sizeof($list), 'firstItem' => 1, 'lastItem' => sizeof($list), 'uriPrevPage' => '', 'uriNextPage' => '');
         ########################################################################
         #### URIS
         ########################################################################
         $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId());
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Proto_Backend_Front::ROUTE_GOODIES_SHOULDIES_UPLOAD);
         $uriDoBatchUnlink = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
         $args = array(Sitengine_Env::PARAM_ANCESTORID => $this->_controller->getEntity()->getAncestorId());
         $route = $this->_controller->getFrontController()->getRouter()->getRoute(Sitengine_Proto_Backend_Front::ROUTE_GOODIES_SHOULDIES_ASSIGN);
         $uriDoBatchAssign = $this->_controller->getRequest()->getBasePath() . '/' . $route->assemble($args, true);
         $uris = array('submitDoBatchAssign' => $uriDoBatchAssign, 'submitDoBatchUnlink' => $uriDoBatchUnlink);
         ########################################################################
         #### METHODS
         ########################################################################
         $methods = array('doBatchUnlink' => Sitengine_Env::METHOD_DELETE, 'doBatchAssign' => Sitengine_Env::METHOD_POST);
         ########################################################################
         #### COLLECT ALL DATA
         ########################################################################
         $hiddens = array(Sitengine_Env::PARAM_METHOD => '');
         foreach ($hiddens as $k => $v) {
             $hiddens[$k] = Sitengine_Form_Element::getHidden($k, $v);
         }
         return array('hiddens' => implode('', $hiddens), 'title' => $this->_controller->getTranslate()->translate('assignViewAssignFormTitle'), 'URIS' => $uris, 'METHODS' => $methods, 'DATA' => $list, 'PAGER' => $pagerData);
     } catch (Exception $exception) {
         require_once 'Sitengine/Proto/Backend/Goodies/Shouldies/Exception.php';
         throw new Sitengine_Proto_Backend_Goodies_Shouldies_Exception('list page error', $exception);
     }
 }
开发者ID:sitengine,项目名称:sitengine,代码行数:77,代码来源:AssignView.php

示例6: detailAction

 /**
  * details der bestellung anzeigen
  */
 public function detailAction()
 {
     // init
     $order = Object_OnlineShopOrder::getById($this->getParam('id'));
     /* @var OnlineShop_Framework_AbstractOrder $order */
     $orderAgent = $this->view->orderAgent = $this->orderManager->createOrderAgent($order);
     /**
      * @param array $address
      *
      * @return string
      */
     $geoPoint = function (array $address) {
         # https://developers.google.com/maps/documentation/geocoding/index?hl=de#JSON
         $url = sprintf('http://maps.googleapis.com/maps/api/geocode/json?address=%1$s&sensor=false', urlencode($address[0] . ' ' . $address[1] . ' ' . $address[2] . ' ' . $address[3]));
         $json = json_decode(file_get_contents($url));
         return $json->results[0]->geometry->location;
     };
     // get geo point
     $this->view->geoAddressInvoice = $geoPoint([$order->getCustomerStreet(), $order->getCustomerZip(), $order->getCustomerCity(), $order->getCustomerCountry()]);
     if ($order->getDeliveryStreet() && $order->getDeliveryZip()) {
         $this->view->geoAddressDelivery = $geoPoint([$order->getDeliveryStreet(), $order->getDeliveryZip(), $order->getDeliveryCity(), $order->getDeliveryCountry()]);
     }
     // get customer info
     if ($order->getCustomer()) {
         // init
         $arrCustomerAccount = [];
         $customer = $order->getCustomer();
         // register
         $register = new Zend_Date($order->getCreationDate());
         $arrCustomerAccount['created'] = $register->get(Zend_Date::DATE_MEDIUM);
         // mail
         if (method_exists($customer, 'getEMail')) {
             $arrCustomerAccount['email'] = $customer->getEMail();
         }
         // order count
         $addOrderCount = function () use($customer, $arrCustomerAccount) {
             $order = new Object_OnlineShopOrder();
             $field = $order->getClass()->getFieldDefinition('customer');
             if ($field instanceof \Pimcore\Model\Object\ClassDefinition\Data\Href) {
                 if (count($field->getClasses()) == 1) {
                     $class = 'Pimcore\\Model\\Object\\' . reset($field->getClasses())['classes'];
                     /* @var \Pimcore\Model\Object\Concrete $class */
                     $orderList = $this->orderManager->createOrderList();
                     $orderList->joinCustomer($class::classId());
                     $orderList->getQuery()->where('customer.o_id = ?', $customer->getId());
                     $arrCustomerAccount['orderCount'] = $orderList->count();
                 }
             }
         };
         $addOrderCount();
         $this->view->arrCustomerAccount = $arrCustomerAccount;
     }
     // create timeline
     $arrIcons = ['itemChangeAmount' => 'glyphicon glyphicon-pencil', 'itemCancel' => 'glyphicon glyphicon-remove', 'itemComplaint' => 'glyphicon glyphicon-alert'];
     $arrContext = ['itemChangeAmount' => 'default', 'itemCancel' => 'danger', 'itemComplaint' => 'warning'];
     $arrTimeline = [];
     $date = new Zend_Date();
     foreach ($orderAgent->getFullChangeLog() as $note) {
         /* @var \Pimcore\Model\Element\Note $note */
         // get avatar
         $user = Pimcore_Model_User::getById($note->getUser());
         /* @var \Pimcore\Model\User $user */
         $avatar = sprintf('/admin/user/get-image?id=%d', $user->getId());
         // group events
         $group = $date->setTimestamp($note->getDate())->get(Zend_Date::DATE_MEDIUM);
         // load reference
         $reference = Pimcore\Model\Object\Concrete::getById($note->getCid());
         $title = $reference instanceof OnlineShop_Framework_AbstractOrderItem ? $reference->getProduct()->getOSName() : null;
         // add
         $arrTimeline[$group][] = ['icon' => $arrIcons[$note->getTitle()], 'context' => $arrContext[$note->getTitle()] ?: 'default', 'type' => $note->getTitle(), 'date' => $date->setTimestamp($note->getDate())->get(Zend_Date::DATETIME_MEDIUM), 'avatar' => $avatar, 'user' => $user->getName(), 'message' => $note->getData()['message']['data'], 'title' => $title ?: $note->getTitle()];
     }
     $this->view->timeLine = $arrTimeline;
 }
开发者ID:ascertain,项目名称:NGshop,代码行数:76,代码来源:AdminOrderController.php

示例7: parseDate

 /**
  * Enter description here...
  *
  * @return Zend_Date
  */
 protected function parseDate($date)
 {
     $epoch = strtotime($date);
     if (false === $epoch) {
         $date = new Zend_Date($date, $this->_format);
     } else {
         $date = new Zend_Date();
         $date->setTimestamp($epoch);
     }
     return $date;
 }
开发者ID:jager,项目名称:cms,代码行数:16,代码来源:Date.php

示例8: fromTimestamp

 public function fromTimestamp($timestamp, $format = Mage_Core_Model_Locale::FORMAT_TYPE_SHORT)
 {
     $dateFormat = Mage::app()->getLocale()->getDateFormat($format);
     $date = new Zend_Date();
     $date->setTimestamp($timestamp);
     return $date->toString($dateFormat);
 }
开发者ID:cnglobal-sl,项目名称:caterez,代码行数:7,代码来源:Date.php

示例9: calcDate

 /**
  * Calculate date
  *
  * @param number $value
  * @param string $unit
  * @param number $roundDate
  * @return Zend_Date
  */
 public function calcDate($value, $unit, $roundDate = null, $sign = '-')
 {
     // validate unit
     if (!key_exists($unit, $this->getTimeUnitOptions())) {
         return null;
     }
     $timestamp = strtotime("{$sign}{$value} {$unit}");
     if ($timestamp) {
         // don't calculate with extrem high numbers (preformance)
         $timestamp = min(max($timestamp, 0), 10000000000.0);
         $date = new Zend_Date();
         $date->setTimestamp($timestamp);
         if ($roundDate === self::DAY_START) {
             $date->setHour(0);
             $date->setMinute(0);
             $date->setSecond(0);
         } else {
             if ($roundDate === self::DAY_END) {
                 $date->setHour(23);
                 $date->setMinute(59);
                 $date->setSecond(59);
             }
         }
         return $date;
     }
     return null;
 }
开发者ID:jsiefer,项目名称:emarketing,代码行数:35,代码来源:Data.php

示例10: hasTile

 /**
  * it checks if there is such valid tile image in cache
  *
  * @param int $x
  * @param int $y
  * @param int $zoom
  * @return bool
  */
 public function hasTile($x, $y, $zoom)
 {
     $fileName = $this->_getFileName($x, $y, $zoom);
     $actualTime = new Zend_Date();
     if (file_exists($fileName)) {
         $fileTime = new Zend_Date();
         $fileTime->setTimestamp(filemtime($this->_getFileName($x, $y, $zoom)));
         $fileTime->addDay(self::$daysToRemember);
         if ($fileTime->isLater($actualTime)) {
             return true;
         }
     }
     return false;
 }
开发者ID:pafciu17,项目名称:gsoc-os-static-maps-api,代码行数:22,代码来源:TileCache.php


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