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


PHP Zend_Date::isToday方法代码示例

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


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

示例1: getActiveMotds

 /**
  * Retrieves all active MOTDs.
  *
  * @return array
  * An associative array containing the details of the active MOTDs, or null
  * if there are no active MOTDs.
  */
 public function getActiveMotds()
 {
     $returnArray = array();
     //Retrieve all MOTDs.
     $motds = new Datasource_Cms_Connect_Motd();
     $motdsArray = $motds->getAll();
     foreach ($motdsArray as $currentMotd) {
         if ($currentMotd['active'] == 1) {
             //Ensure the today is captured in the MOTD date range.
             $displayFrom = new Zend_Date($currentMotd['displayFrom'], Zend_Date::ISO_8601);
             $displayTo = new Zend_Date($currentMotd['displayTo'], Zend_Date::ISO_8601);
             $now = Zend_Date::now();
             if ($displayFrom->isToday() || $displayTo->isToday()) {
                 $returnArray[] = $currentMotd;
             } else {
                 if ($now->isLater($displayFrom) && $now->isEarlier($displayTo)) {
                     $returnArray[] = $currentMotd;
                 }
             }
         }
     }
     //Clean up the return value consistent with this function's contract.
     if (empty($returnArray)) {
         $returnVal = null;
     } else {
         $returnVal = $returnArray;
     }
     return $returnVal;
 }
开发者ID:AlexEvesDeveloper,项目名称:hl-stuff,代码行数:36,代码来源:MotdAccessor.php

示例2: date

 public function date($value, $displayTime = false)
 {
     if ($displayTime) {
         $translate = Zend_Registry::get('Zend_Translate');
         $locale = key(Zend_Registry::get('Zend_Locale')->getDefault());
         $date = new Zend_Date($value, null, $locale);
         if ($date->isToday()) {
             $h = $date->toString('H');
             $m = $date->toString('m');
             $s = $date->toString('s');
             if (date('H') == $h) {
                 $min = (int) date('i') - (int) $m;
                 if ($min < 1) {
                     $sec = (int) date('s') - (int) $s;
                     if ($sec < 10) {
                         return $translate->_('now');
                     }
                     return $sec . ' ' . $translate->_('seconds ago');
                 }
                 return $min . ' ' . $translate->_('minutes ago');
             } elseif (date('H') > $h) {
                 return (int) date('H') - (int) $h . ' ' . $translate->_('hours ago');
             }
             return $date->toString('H:m');
         } else {
             return $date->toString('dd/MM/y H:m');
         }
     }
     return Zend_Filter::filterStatic($value, 'date', array(), 'Tri_Filter');
 }
开发者ID:ramonornela,项目名称:trilhas,代码行数:30,代码来源:Date.php

示例3: baseInit

 public function baseInit()
 {
     $this->datee(false, 'date_for', "Data od:", true);
     $this->date_for->addValidator('Callback', false, array('callback' => function ($value) {
         $date = new Zend_Date();
         $date->setDate($value, 'YYYY-MM-dd');
         return $date->isEarlier(new Zend_date()) || $date->isToday();
     }, 'messages' => array(Zend_Validate_Callback::INVALID_VALUE => "Data od nie może być datą przyszłą")));
     $this->datee(false, 'date_to', "Data do:", true);
     $this->date_to->addValidator('Callback', false, array('callback' => function ($value) {
         $date = new Zend_Date();
         $date->setDate($value, 'YYYY-MM-dd');
         return $date->isEarlier(new Zend_date()) || $date->isToday();
     }, 'messages' => array(Zend_Validate_Callback::INVALID_VALUE => "Data do nie może być datą przyszłą")));
     $this->submit(false, 'create_raport', 'Generuj raport');
 }
开发者ID:knatorski,项目名称:SMS,代码行数:16,代码来源:Search.php

示例4: getisvaliddateAction

 public function getisvaliddateAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     $this->_helper->layout()->disableLayout();
     $dateText = $this->getRequest()->getParam('dateText');
     $objSelectedDate = new Zend_Date($dateText, Zend_Date::ISO_8601);
     $objTodayDate = new Zend_Date(Zend_Date::now(), Zend_Date::ISO_8601);
     if ($objSelectedDate->isToday($dateText)) {
         echo 1;
         return;
     }
     if ($objSelectedDate->isEarlier($objTodayDate) || $objSelectedDate->isDate($dateText)) {
         echo 0;
         return;
     }
     echo 1;
 }
开发者ID:sivarajankumar,项目名称:eduis,代码行数:17,代码来源:DateController.php

示例5: dateFormater

 /** 
  * 根据时间戳,返回人读时间格式
  * 
  * @param String $timestamp
  * 
  * @return Array $new_date
  */
 public static function dateFormater($timestamp)
 {
     $t = Zend_Registry::get('translate');
     $result = array();
     $date = new Zend_Date($timestamp);
     $result['date'] = $date->toString('YYYY-MM-dd');
     $result['time'] = $date->toString('HH:mm');
     //解析时间
     if ($date->isToday()) {
         $result['dateHuman'] = $t->_('Today');
     } elseif ($date->isTomorrow()) {
         $result['dateHuman'] = $t->_('Tomorrow');
     } elseif ($date->isYesterday()) {
         $result['dateHuman'] = $t->_('Yesterday');
     }
     return $result;
 }
开发者ID:sandin,项目名称:iMemo,代码行数:24,代码来源:MainInput.php

示例6: testToday

 /**
  * Test for Today
  */
 public function testToday()
 {
     $locale = new Zend_Locale('de_AT');
     $date = new Zend_Date(Zend_Date::now());
     $d2 = new Zend_Date(1010101010, $locale);
     $this->assertFalse($d2->isToday());
     $this->assertTrue($date->isToday());
 }
开发者ID:jsnshrmn,项目名称:Suma,代码行数:11,代码来源:DateTest.php


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