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


PHP Zend_Date::addDay方法代码示例

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


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

示例1: setUp

	/**
	 * Initialization.
	 * @see PHPUnit_Framework_TestCase::setUp()
	 */
	protected function setUp() {
		$this->requested_at = new Zend_Date();
		$this->received_at = new Zend_Date();
		$this->received_at->addDay(14)->addHour(1)->addMinute(15);

		$this->history = new Blipoteka_Book_History();
		$this->history->borrower_id = 1;
		$this->history->lender_id = 2;
		$this->history->book_id = 1;
		$this->history->requested_at = $this->requested_at->get(Zend_Date::W3C);
		$this->history->received_at = $this->received_at->get(Zend_Date::W3C);
	}
开发者ID:niieani,项目名称:nandu,代码行数:16,代码来源:HistoryTest.php

示例2: indexAction

 public function indexAction()
 {
     // numero da semana anterior
     $zendDate = new Zend_Date();
     $semana = $zendDate->get(Zend_Date::WEEK) - 1;
     $dia_semana = $zendDate->get(Zend_Date::WEEKDAY_DIGIT);
     $zendDate->subDay(7);
     $dia_semana_inicio = $dia_semana - 1;
     $dia_semana_fim = 7 - $dia_semana;
     $periodo_inicial = $zendDate->subDay($dia_semana_inicio)->get("dd/MM/YYYY");
     $periodo_final = $zendDate->addDay($dia_semana_fim)->get('dd/MM/YYYY');
     $periodo = $periodo_inicial . ' à ' . $periodo_final;
     // busca as visualizacoes da semana
     $modelSalaoVisualizacao = new Model_DbTable_SalaoVisualizacao();
     $visualizacoes = $modelSalaoVisualizacao->visualizacoes($semana);
     try {
         foreach ($visualizacoes as $visualizacao) {
             $pluginMail = new Plugin_Mail();
             $pluginMail->setDataMail('visualizacao', $visualizacao);
             $pluginMail->setDataMail('periodo', $periodo);
             $pluginMail->send("salao-visualizacao.phtml", "Relatório de Visualizações", $visualizacao->salao_email);
         }
         echo 'emails enviados';
     } catch (Zend_Mail_Exception $ex) {
         die('email');
     } catch (Exception $ex) {
         Zend_Debug::dump($ex->getMessage());
     }
 }
开发者ID:nandorodpires2,项目名称:homemakes,代码行数:29,代码来源:VisualizacaoController.php

示例3: createMultipleTrips

 /**
  * Create multiple trips. We can call it scheduling the bus board. 
  * @param int $routeID
  * @param int $tripCount
  * @param int $dayCount
  * @param string $startDate
  * @param array $tripLines
  */
 public function createMultipleTrips($routeID, $tripCount, $dayCount, $startDate, $tripLines = array())
 {
     if (empty($tripLines) || count($tripLines) != $tripCount) {
         throw new Exception('Something wrong');
     }
     $db = Zend_Db_Table::getDefaultAdapter();
     $db->beginTransaction();
     try {
         for ($i = 0; $i < $dayCount; ++$i) {
             foreach ($tripLines as $tripLine) {
                 $departureDatetimeObj = new Zend_Date(TBB_Utility_Date::formatDateTime($tripLine['departureTime'], 'dd-MM-y HH:mm:ss', 'y-MM-dd HH:mm:ss'));
                 $departureDatetimeObj->addDay($i);
                 $arrivalDatetimeObj = new Zend_Date(TBB_Utility_Date::formatDateTime($tripLine['arrivalTime'], 'dd-MM-y HH:mm:ss', 'y-MM-dd HH:mm:ss'));
                 $arrivalDatetimeObj->addDay($i);
                 $tripRow = $this->createRow();
                 $tripRow->route_id = $routeID;
                 $tripRow->bus_id = $tripLine['bus'];
                 $tripRow->departure_time = $departureDatetimeObj->toString('y-MM-dd HH:mm:ss');
                 $tripRow->arrival_time = $arrivalDatetimeObj->toString('y-MM-dd HH:mm:ss');
                 $tripRow->fare = $tripLine['fare'];
                 $tripRow->expired = 0;
                 $tripRow->save();
             }
         }
         $db->commit();
     } catch (Exception $e) {
         $db->rollBack();
         throw new $e();
     }
 }
开发者ID:rizkioa,项目名称:etak6,代码行数:38,代码来源:Trip.php

示例4: save

 public function save(Default_Model_Pastebin $pastebin)
 {
     $shortId = $pastebin->getShortId();
     if (empty($shortId)) {
         $shortId = $this->_getShortId();
         $pastebin->setShortId($shortId);
     }
     $name = $pastebin->getName();
     $expiresTime = $pastebin->getExpires();
     $expires = null;
     if ($expiresTime != 'never') {
         $expires = new Zend_Date();
         if ($expiresTime == 'hour') {
             $expires->addHour(1);
         }
         if ($expiresTime == 'day') {
             $expires->addDay(1);
         }
         if ($expiresTime == 'week') {
             $expires->addWeek(1);
         }
         if ($expiresTime == 'month') {
             $expires->addMonth(1);
         }
         $expires = $expires->get('yyyy-MM-dd HH:mm:ss');
     }
     $data = array('short_id' => $shortId, 'name' => !empty($name) ? $name : 'Anonymous', 'code' => $pastebin->getCode(), 'language' => $pastebin->getLanguage(), 'expires' => $expires, 'ip_address' => $_SERVER['REMOTE_ADDR'], 'created' => date('Y-m-d H:i:s'));
     if (null === ($id = $pastebin->getId())) {
         unset($data['id']);
         $this->getDbTable()->insert($data);
     } else {
         $this->getDbTable()->update($data, array('id = ?' => $id));
     }
     return $shortId;
 }
开发者ID:sebflipper,项目名称:zf-pastebin,代码行数:35,代码来源:PastebinMapper.php

示例5: getTransactionList

 /**
  * (non-PHPdoc)
  *
  * @see library/Oara/Network/Oara_Network_Publisher_Base#getTransactionList($merchantId, $dStartDate, $dEndDate)
  */
 public function getTransactionList($merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null, $merchantMap = null)
 {
     $totalTransactions = array();
     $dEndDate->addDay(1);
     $valuesFormExport = Oara_Utilities::cloneArray($this->_exportTransactionParameters);
     $valuesFormExport[] = new Oara_Curl_Parameter('pDate1', $dStartDate->toString("MM/d/yyyy"));
     $valuesFormExport[] = new Oara_Curl_Parameter('pDate2', $dEndDate->toString("MM/d/yyyy"));
     $urls = array();
     $urls[] = new Oara_Curl_Request('https://www.auto-europe.co.uk/afftools/iatareport_popup.cfm?', $valuesFormExport);
     $exportReport = $this->_client->post($urls);
     $xmlTransactionList = self::readTransactions($exportReport[0]);
     foreach ($xmlTransactionList as $xmlTransaction) {
         $transaction = array();
         $transaction['merchantId'] = 1;
         $date = new Zend_date($xmlTransaction['Booked'], "MM/dd/yyyy");
         $transaction['date'] = $date->toString("yyyy-MM-dd 00:00:00");
         $transaction['amount'] = (double) $xmlTransaction['commissionValue'];
         $transaction['commission'] = (double) $xmlTransaction['commission'];
         $transaction['status'] = Oara_Utilities::STATUS_CONFIRMED;
         $transaction['unique_id'] = $xmlTransaction['Res #'];
         if (isset($xmlTransaction['Affiliate1']) && isset($xmlTransaction['Affiliate2'])) {
             $customId = (string) $xmlTransaction['Affiliate1'] . (string) $xmlTransaction['Affiliate2'];
             $customId = "afal-" . current(unpack('H*', base64_decode(str_replace(array(".", "-"), array("/", "+"), $customId))));
             $transaction['custom_id'] = $customId;
         }
         $totalTransactions[] = $transaction;
     }
     return $totalTransactions;
 }
开发者ID:netzkind,项目名称:php-oara,代码行数:34,代码来源:AutoEurope.php

示例6: addExpiredAfterDaysFilter

 public function addExpiredAfterDaysFilter($daysToAdd)
 {
     $currentZendDate = new Zend_Date();
     $dateAfterDays = $currentZendDate->addDay($daysToAdd + 1)->toString(Varien_Date::DATE_INTERNAL_FORMAT);
     $this->getSelect()->where('expiration_date < ?', $dateAfterDays)->where('expiration_notification_sent IS NULL')->order('summary_id');
     return $this;
 }
开发者ID:monarcmoso,项目名称:beta2,代码行数:7,代码来源:AW_Points_Model_Mysql4_Transaction_Collection.php

示例7: getLocaleAction

 /**
  * JavaScript get-locale action
  */
 public function getLocaleAction()
 {
     $aLocale = array();
     try {
         $sFileName = APPLICATION_PATH . '/i18n/' . $this->localizer->getLocale()->getLanguage() . '.txt';
         if (!file_exists($sFileName) || !is_file($sFileName) || !is_readable($sFileName)) {
             throw new AM_Component_Exception('Localisation file not found');
         }
         $aFile = file($sFileName);
         while (list($iLineNumber, $sLine) = each($aFile)) {
             $sLine = trim($sLine);
             if (!$sLine || strlen($sLine) < 3 || substr($sLine, 0, 3) != 'js_') {
                 continue;
             }
             $aPair = explode('=', substr($sLine, 3));
             if (count($aPair) != 2 || !$aPair[0] || !$aPair[1]) {
                 continue;
             }
             $aLocale[$aPair[0]] = $aPair[1];
         }
         $oDate = new Zend_Date();
         $oDate->addDay(self::LOCALE_EXPIRES_DAYS);
         $this->getResponse()->setHeader('Content-type', 'text/javascript')->setHeader('Content-Disposition:inline', ' filename=locale.js')->setHeader('Pragma', 'public', true)->setHeader('Cache-Control', 'maxage=' . 60 * 60 * 24 * self::LOCALE_EXPIRES_DAYS, true)->setHeader('Expires', $oDate->toString('EE, d M Y H:i:s ') . 'GMT', true);
     } catch (Exception $ex) {
     }
     $this->view->locale = $aLocale;
 }
开发者ID:pansot2,项目名称:PadCMS-backend,代码行数:30,代码来源:JavaScriptController.php

示例8: createNew

 public static function createNew($rule, $startFrom = null)
 {
     $date = new Zend_Date();
     $date->addDay((int) $rule->getCouponExpireDays());
     $date->setHour(0)->setMinute(0)->setSecond(0);
     if (!is_null($startFrom)) {
         $date->addDay((int) $startFrom);
     }
     $coupon = Mage::getModel('followupemail/coupons');
     $salesRule = Mage::getModel('salesrule/rule')->load($rule->getCouponSalesRuleId());
     if ($salesRule->getData()) {
         $_usagePerCustomer = $salesRule->getUsesPerCustomer() && is_numeric($salesRule->getUsesPerCustomer()) ? $salesRule->getUsesPerCustomer() : 1;
         $coupon->setRuleId($rule->getCouponSalesRuleId())->setExpirationDate($date)->setCode(Mage::helper('followupemail/coupon')->generateCode($rule->getId(), $rule->getCouponPrefix()))->setUsagePerCustomer($_usagePerCustomer)->setUsageLimit($_usagePerCustomer);
         $coupon->save();
     }
     return $coupon;
 }
开发者ID:ngagestudios,项目名称:emailreminders,代码行数:17,代码来源:Coupon.php

示例9: addExpireAfterDaysFilter

 public function addExpireAfterDaysFilter($dayBefore)
 {
     $date = Mage::getModel('core/date')->gmtDate();
     $zendDate = new Zend_Date($date);
     $dayAfter = $zendDate->addDay($dayBefore)->toString('YYYY-MM-dd');
     $this->getSelect()->where('date(expired_at) = ?', $dayAfter);
     return $this;
 }
开发者ID:CherylMuniz,项目名称:fashion,代码行数:8,代码来源:Collection.php

示例10: getExpirationDate

 public function getExpirationDate()
 {
     if ($timeLife = Mage::helper('customerreward')->getEarnConfig('expire')) {
         //$currentDate = Mage::getModel('core/date')->gmtDate();
         $expire = new Zend_Date();
         //$currentDate);
         $expire->addDay($timeLife);
         return $expire->toString('YYYY-MM-dd HH:mm:ss');
     }
     return null;
 }
开发者ID:AmineCherrai,项目名称:rostanvo,代码行数:11,代码来源:Transaction.php

示例11: getIntervals

 public function getIntervals()
 {
     if (!$this->_intervals) {
         $this->_intervals = array();
         if (!$this->_from && !$this->_to) {
             return $this->_intervals;
         }
         $dateStart = new Zend_Date($this->_from);
         $dateEnd = new Zend_Date($this->_to);
         $t = array();
         $firstInterval = true;
         /** START AITOC FIX **/
         if (in_array((string) $this->_period, array('day', 'month', 'year'))) {
             /** END AITOC FIX **/
             while ($dateStart->compare($dateEnd) <= 0) {
                 switch ($this->_period) {
                     case 'day':
                         $t['title'] = $dateStart->toString(Mage::app()->getLocale()->getDateFormat());
                         $t['start'] = $dateStart->toString('yyyy-MM-dd HH:mm:ss');
                         $t['end'] = $dateStart->toString('yyyy-MM-dd 23:59:59');
                         $dateStart->addDay(1);
                         break;
                     case 'month':
                         $t['title'] = $dateStart->toString('MM/yyyy');
                         $t['start'] = $firstInterval ? $dateStart->toString('yyyy-MM-dd 00:00:00') : $dateStart->toString('yyyy-MM-01 00:00:00');
                         $lastInterval = $dateStart->compareMonth($dateEnd->getMonth()) == 0;
                         $t['end'] = $lastInterval ? $dateStart->setDay($dateEnd->getDay())->toString('yyyy-MM-dd 23:59:59') : $dateStart->toString('yyyy-MM-' . date('t', $dateStart->getTimestamp()) . ' 23:59:59');
                         $dateStart->addMonth(1);
                         if ($dateStart->compareMonth($dateEnd->getMonth()) == 0) {
                             $dateStart->setDay(1);
                         }
                         $firstInterval = false;
                         break;
                     case 'year':
                         $t['title'] = $dateStart->toString('yyyy');
                         $t['start'] = $firstInterval ? $dateStart->toString('yyyy-MM-dd 00:00:00') : $dateStart->toString('yyyy-01-01 00:00:00');
                         $lastInterval = $dateStart->compareYear($dateEnd->getYear()) == 0;
                         $t['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);
                         }
                         $firstInterval = false;
                         break;
                 }
                 $this->_intervals[$t['title']] = $t;
             }
             /** START AITOC FIX **/
         }
         /** END AITOC FIX **/
     }
     return $this->_intervals;
 }
开发者ID:sagmahajan,项目名称:aswan_release,代码行数:53,代码来源:ReportsReportCollection.php

示例12: getbookdetailsAction

 public function getbookdetailsAction()
 {
     self::createModel();
     $request = $this->getRequest();
     $acc_no = $request->getParam('acc_no');
     $objIsbn = new Lib_Model_DbTable_Isbn();
     $objIssueReturn = new Lib_Model_DbTable_IssueReturn();
     $book = array();
     if (isset($acc_no)) {
         $bookInfo = Lib_Model_DbTable_Book::getBookInfo($acc_no);
         if (isset($bookInfo['isbn_id'])) {
             $book = $objIsbn->getIsbnDetails($bookInfo['isbn_id']);
             $bookIssued = $objIssueReturn->getIssuedBookInfo($acc_no);
             //$this->_helper->logger($bookIssued);
             if ($bookIssued) {
                 $issueDate = new Zend_Date($bookIssued['issue_date'], Zend_Date::ISO_8601);
                 $book['member_id'] = $bookIssued['member_id'];
                 $member_limit = Lib_Model_DbTable_MembershipLimit::getMemberLimit($book['member_id'], $bookInfo['document_type_id']);
                 if (isset($_SESSION['dateFormat'])) {
                     $dateFormat = $_SESSION['dateFormat'];
                 } else {
                     $dateFormat = 'dd/MMM/yyyy';
                 }
                 $book['issue_date'] = $issueDate->toString($dateFormat);
                 $exp_return_date = $issueDate->addDay($member_limit['day_limit']);
                 $day_late = 0;
                 $objtoday = new Zend_Date(Zend_Date::now(), $dateFormat);
                 if ($exp_return_date->isToday() || $objtoday->isEarlier($exp_return_date)) {
                     $day_late = 0;
                 } else {
                     $objtoday->sub($exp_return_date);
                     $day_late = $objtoday->get(Zend_Date::DAY) - 2;
                 }
                 $book['exp_return_date'] = $exp_return_date->toString($dateFormat);
                 $book['day_late'] = $day_late;
                 $bookStatus = 1;
             }
             $book['bookInfo'] = $bookInfo;
             $this->_helper->json($book);
             //echo Zend_Json::encode($book);
         } else {
             $this->getResponse()->setHttpResponseCode(400);
             echo 'Either the Acc No "' . $acc_no . '" or its corrosponding ISBN is invalid.';
         }
     } else {
         $this->getResponse()->setHttpResponseCode(400);
         echo 'Parameters are insufficient to process.';
     }
 }
开发者ID:sivarajankumar,项目名称:eduis,代码行数:49,代码来源:BookController.php

示例13: addError

 public function addError()
 {
     if ($this->getPromotionId() and $this->getCustomerId()) {
         $now = $this->formatDate(null, 'y-MM-dd HH:mm:ss');
         $date = new Zend_Date($this->getLastError());
         $last_error = $date->addDay(1)->toString('y-MM-dd HH:mm:ss');
         if ($last_error < $now) {
             $nbr = 1;
         } else {
             $nbr = (int) $this->getNumberOfError() + 1;
         }
         $this->setNumberOfError($nbr)->setLastError($now)->save();
         return $this;
     }
 }
开发者ID:bklein01,项目名称:SiberianCMS,代码行数:15,代码来源:Customer.php

示例14: monthAction

 public function monthAction()
 {
     // param handling
     $year = $this->_getParam('year');
     $month = $this->_getParam('month');
     if (!$year or !$month) {
         throw new Exception('');
     }
     // start & stop date
     $startDate = new Zend_Date($year . '-' . $month . '-01', 'yyyy-M-dd');
     $stopDate = new Zend_Date($startDate);
     $stopDate->addMonth(1)->addDay(-1);
     // spacings (start & end)
     $startSpace = $startDate->get(Zend_Date::WEEKDAY_8601) - 1;
     $stopSpace = 7 - $stopDate->get(Zend_Date::WEEKDAY_8601);
     // arrays
     $calendar = array();
     $week = array();
     for ($startSpace; $startSpace >= 1; $startSpace--) {
         $spaceDate = new Zend_Date($startDate);
         $spaceDate->addDay(-$startSpace);
         $day = array('date' => $spaceDate);
         $week[] = $day;
     }
     for ($currentDay = 1; $currentDay <= $stopDate->get('d'); $currentDay++) {
         $currentDate = new Zend_Date($startDate);
         $currentDate->setDay($currentDay);
         $day = array('date' => $currentDate);
         $week[] = $day;
         if (count($week) / 7 == 1) {
             $calendar[] = array('info' => $currentDate, 'columns' => $week);
             $week = array();
         }
     }
     for ($stopSpace; $stopSpace >= 1; $stopSpace--) {
         $spaceDate = new Zend_Date($stopDate);
         $spaceDate->addDay(-$stopSpace);
         $day = array('date' => $spaceDate);
         $week[] = $day;
         if (count($week) / 7 == 1) {
             $calendar[] = array('info' => $currentDate, 'columns' => $week);
             $week = array();
         }
     }
     // view
     $this->view->rows = $calendar;
 }
开发者ID:jaspermeijaard,项目名称:home-booking-system,代码行数:47,代码来源:CalendarController.php

示例15: getDateExpire

 /**
  * Returns probably expire date
  * @return Zend_Date
  */
 public function getDateExpire()
 {
     if (!$this->getData('date_expire')) {
         if (!$this->isInfinite()) {
             foreach (Mage::getModel('sarp/sequence')->getCollection()->addSubscriptionFilter($this)->setOrder('date', 'desc') as $SequenceItem) {
                 $offset = $this->getPeriod()->getPaymentOffset();
                 $date = new Zend_Date($SequenceItem->getDate(), self::DB_DATE_FORMAT);
                 return $date->addDay($offset);
                 //return Mage::app()->getLocale()->date($SequenceItem->getDate(), self::DB_DATE_FORMAT);
             }
         } else {
             // No expiration date
             return $this->getNextSubscriptionEventDate(new Zend_Date());
         }
     }
     return new Zend_Date();
 }
开发者ID:par-orillonsoft,项目名称:magento_work,代码行数:21,代码来源:Subscription.php


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