當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Date::getMonth方法代碼示例

本文整理匯總了PHP中Zend_Date::getMonth方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Date::getMonth方法的具體用法?PHP Zend_Date::getMonth怎麽用?PHP Zend_Date::getMonth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend_Date的用法示例。


在下文中一共展示了Zend_Date::getMonth方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testGetMonth

 /**
  * Test for getMonth
  */
 public function testGetMonth()
 {
     $locale = new Zend_Locale('de_AT');
     $date = new Zend_Date(1234567890, $locale);
     $d2 = new Zend_Date(1610101010, $locale);
     $date->setTimeZone(date_default_timezone_get());
     $d2->setTimeZone(date_default_timezone_get());
     $result = $date->getMonth();
     $this->assertTrue($result instanceof Zend_Date);
     $this->assertSame($result->toString(), '01.02.1970 05:00:00');
     $this->assertSame($date->getMonth()->toString(), '01.02.1970 05:00:00');
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:15,代碼來源:DateTest.php

示例2: checkIfCcIsExpired

 public function checkIfCcIsExpired($expMonth, $expYear)
 {
     $today = new Zend_Date(Mage::app()->getLocale()->storeTimeStamp());
     $currentYear = (int) $today->getYear()->toString("YY");
     $currentMonth = (int) $today->getMonth()->toString("MM");
     if ($currentYear > (int) $expYear) {
         return false;
     }
     if ($currentYear == (int) $expYear && $currentMonth > (int) $expMonth) {
         return false;
     }
     return true;
 }
開發者ID:hipay,項目名稱:hipay-fullservice-sdk-magento1,代碼行數:13,代碼來源:Data.php

示例3: _getYearInterval

 /**
  * Get Interval for a year
  *
  * @param Zend_Date $dateStart
  * @param Zend_Date $dateEnd
  * @param bool $firstInterval
  * @return array
  */
 protected function _getYearInterval(Zend_Date $dateStart, Zend_Date $dateEnd, $firstInterval)
 {
     $interval = array();
     $interval['period'] = $dateStart->toString('yyyy');
     $interval['start'] = $firstInterval ? $dateStart->toString('yyyy-MM-dd 00:00:00') : $dateStart->toString('yyyy-01-01 00:00:00');
     $lastInterval = $dateStart->compareYear($dateEnd->getYear()) == 0;
     $interval['end'] = $lastInterval ? $dateStart->setMonth($dateEnd->getMonth())->setDay($dateEnd->getDay())->toString('yyyy-MM-dd 23:59:59') : $dateStart->toString('yyyy-12-31 23:59:59');
     $dateStart->addYear(1);
     if ($dateStart->compareYear($dateEnd->getYear()) == 0) {
         $dateStart->setMonth(1)->setDay(1);
     }
     return $interval;
 }
開發者ID:natxetee,項目名稱:magento2,代碼行數:21,代碼來源:Collection.php

示例4: getCards

 public function getCards()
 {
     if (is_null($this->_cards)) {
         $today = new Zend_Date(Mage::app()->getLocale()->storeTimeStamp());
         $currentYear = (int) $today->getYear()->toString("YY");
         $currentMonth = (int) $today->getMonth()->toString("MM");
         $this->_cards = Mage::getResourceModel('hipay/card_collection')->addFieldToSelect('*')->addFieldToFilter('customer_id', $this->getCustomer()->getId())->addFieldToFilter('cc_status', Allopass_Hipay_Model_Card::STATUS_ENABLED)->addFieldToFilter('cc_exp_year', array("gteq" => $currentYear))->setOrder('card_id', 'desc')->setOrder('is_default', 'desc');
         foreach ($this->_cards as $card) {
             if ($card->ccExpYear == $currentYear && $currentMonth < $card->ccExpMonth) {
                 $this->_cards->removeItemByKey($card->getId());
             }
         }
     }
     return $this->_cards;
 }
開發者ID:hipay,項目名稱:hipay-fullservice-sdk-magento1,代碼行數:15,代碼來源:Abstract.php

示例5: testGettingMonthWhenUsingGNU

 /**
  * @ZF-9085
  */
 public function testGettingMonthWhenUsingGNU()
 {
     Zend_Date::setOptions(array('format_type' => 'php'));
     $date = new Zend_Date(array('day' => 1, 'month' => 4, 'year' => 2008));
     $date2 = $date->getMonth();
     $result = $date2->toArray();
     $this->assertEquals(1970, $result['year']);
 }
開發者ID:jsnshrmn,項目名稱:Suma,代碼行數:11,代碼來源:DateTest.php


注:本文中的Zend_Date::getMonth方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。