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


PHP QDateTime::IsEarlierThan方法代码示例

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


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

示例1: Validate

 public function Validate()
 {
     if (!parent::Validate()) {
         return false;
     }
     if ($this->strText != '') {
         $dttDateTime = new QDateTime($this->strText);
         if ($dttDateTime->IsDateNull()) {
             $this->strValidationError = QApplication::Translate("invalid date");
             return false;
         }
         if (!is_null($this->Minimum)) {
             if ($dttDateTime->IsEarlierThan($this->Minimum)) {
                 $this->strValidationError = QApplication::Translate("date is earlier than minimum allowed");
                 return false;
             }
         }
         if (!is_null($this->Maximum)) {
             if ($dttDateTime->IsLaterThan($this->Maximum)) {
                 $this->strValidationError = QApplication::Translate("date is later than maximum allowed");
                 return false;
             }
         }
     }
     $this->strValidationError = '';
     return true;
 }
开发者ID:hiptc,项目名称:dle2wordpress,代码行数:27,代码来源:QDatepickerBoxBase.class.php

示例2: Validate

 /**
  * Validate the control.
  * @return bool
  */
 public function Validate()
 {
     if (!parent::Validate()) {
         return false;
     }
     if ($this->strText != '') {
         $dttDateTime = new QDateTime($this->strText, null, QDateTime::DateOnlyType);
         if ($dttDateTime->IsDateNull()) {
             $this->ValidationError = QApplication::Translate("Invalid date");
             return false;
         }
         if (!is_null($this->Minimum)) {
             if ($dttDateTime->IsEarlierThan($this->Minimum)) {
                 if ($this->strMinDateErrorMsg) {
                     $this->ValidationError = $this->strMinDateErrorMsg;
                 } else {
                     $this->ValidationError = QApplication::Translate("Date is earlier than minimum allowed");
                 }
                 return false;
             }
         }
         if (!is_null($this->Maximum)) {
             if ($dttDateTime->IsLaterThan($this->Maximum)) {
                 if ($this->strMaxDateErrorMsg) {
                     $this->ValidationError = $this->strMaxDateErrorMsg;
                 } else {
                     $this->ValidationError = QApplication::Translate("Date is later than maximum allowed");
                 }
                 return false;
             }
         }
     }
     return true;
 }
开发者ID:vaibhav-kaushal,项目名称:qc-framework,代码行数:38,代码来源:QDatepickerBoxBase.class.php

示例3: GenerateStewardship

 public static function GenerateStewardship()
 {
     $dttDate = new QDateTime('2004-01-05');
     print 'Generating Stewardship... ';
     $objFundArray = StewardshipFund::QueryArray(QQ::NotEqual(QQN::StewardshipFund()->Id, 1));
     while ($dttDate->IsEarlierThan(QDateTime::Now())) {
         print $strDate = '[' . $dttDate->ToString('YYYY-MMM-DD') . ']';
         $intCheckCount = rand(10, 55);
         $arrStack = array();
         for ($i = 0; $i < floor(($intCheckCount - 1) / 25) + 1; $i++) {
             $arrStack[] = null;
         }
         $objBatch = StewardshipBatch::Create(self::GenerateFromArray(self::$StewardshipUserArray), $arrStack, self::GenerateFromArray(array('Weekend T/O', 'Weekend Giving', 'Tithes and Offerings', 'Tithes & Offerings', null)), $dttDate, $dttDate);
         $intStackCount = $objBatch->CountStewardshipStacks();
         $dttStart = new QDateTime($dttDate);
         $dttStart->SetTime(8, 0, 0);
         $dttEnd = new QDateTime($dttDate);
         $dttEnd->SetTime(16, 0, 0);
         for ($i = 0; $i < $intStackCount; $i++) {
             if ($i == $intStackCount - 1) {
                 if ($intCheckCount % 25 == 0) {
                     $intChecksInStackCount = 25;
                 } else {
                     $intChecksInStackCount = $intCheckCount % 25;
                 }
             } else {
                 $intChecksInStackCount = 25;
             }
             $objStack = StewardshipStack::LoadByStewardshipBatchIdStackNumber($objBatch->Id, $i + 1);
             for ($j = 0; $j < $intChecksInStackCount; $j++) {
                 $objHousehold = self::GenerateFromArray(self::$HouseholdArray);
                 $objHouseholdParticipant = self::GenerateFromArray($objHousehold->GetHouseholdParticipationArray());
                 $mixAmountArray = array();
                 if (rand(0, 50)) {
                     $mixAmountArray[] = array(1, rand(1000, 150000) / 100);
                 } else {
                     $mixAmountArray[] = array(self::GenerateFromArray($objFundArray)->Id, rand(1000, 150000) / 100);
                 }
                 if (!rand(0, 20)) {
                     $mixAmountArray[] = array(self::GenerateFromArray($objFundArray)->Id, rand(1000, 150000) / 100);
                 }
                 $objContribution = StewardshipContribution::Create($objBatch->CreatedByLogin, $objHouseholdParticipant->Person, $objStack, StewardshipContributionType::Check, rand(1000, 9999), $mixAmountArray, self::GenerateDateTime($dttStart, $dttEnd), null, null, null, false);
                 if (rand(0, 5)) {
                     $objContribution->SaveImageFile(__DEVTOOLS_CLI__ . '/datagen_file_assets/check.tif');
                 }
             }
             $objStack->RefreshActualTotalAmount();
         }
         if ($intCheckCount != $objBatch->CountStewardshipContributions()) {
             print "\r\n" . 'MISCOUNT: ' . $objBatch->Id . "\r\n";
         }
         $objBatch->RefreshActualTotalAmount();
         $dttDate->Day += 7;
         print str_repeat(chr(8) . ' ' . chr(8), strlen($strDate));
     }
     print "Done.\r\n";
 }
开发者ID:alcf,项目名称:chms,代码行数:57,代码来源:datagen.cli.php

示例4: __toStringStatusWithHovertip

 /**
  * Returns the status (with hovertip) of a Receipt based on it's ReceivedFlag
  *
  * @param QDatagrid Object $objControl
  * @return string that says either Received or Pending with a hovertip if the Receipt is overdue
  */
 public function __toStringStatusWithHovertip($objControl)
 {
     $dtsDueDate = new QDateTime($this->DueDate);
     $dtsToday = new QDateTime(date('Y-m-d'));
     if ($this->ReceivedFlag) {
         $strToReturn = 'Received';
     } elseif ($this->DueDate && $dtsDueDate->IsEarlierThan($dtsToday)) {
         //$now = new QDateTime(QDateTime::Now);
         $dtsDifference = $dtsToday->Difference($dtsDueDate);
         $lblStatus = new QLabelExt($objControl);
         $lblStatus->HtmlEntities = false;
         $lblStatus->Text = '<strong style="color:#BC3500;">Pending</strong>';
         // create hovertip
         $objHoverTip = new QHoverTip($lblStatus);
         $lblOverdue = new QLabel($objHoverTip);
         $lblOverdue->Text = $dtsDifference->Days == 0 ? 'Due today' : sprintf('%s days overdue', $dtsDifference->Days);
         $objHoverTip->AutoRenderChildren = true;
         $lblStatus->HoverTip = $objHoverTip;
         $strToReturn = $lblStatus->Render(false);
     } elseif ($this->DueDate && ($dtsDueDate->IsLaterThan($dtsToday) || $dtsDueDate->IsEqualTo($dtsToday))) {
         $dtsDifference = $dtsDueDate->Difference($dtsToday);
         $lblStatus = new QLabelExt($objControl);
         $lblStatus->HtmlEntities = false;
         $lblStatus->Text = '<strong style="color:#CC9933">Pending</strong>';
         // create hovertip
         $objHoverTip = new QHoverTip($lblStatus);
         $lblDueIn = new QLabel($objHoverTip);
         $lblDueIn->Text = $dtsDifference->Days == 0 ? 'Due today' : sprintf('Due in %s days', $dtsDifference->Days);
         $objHoverTip->AutoRenderChildren = true;
         $lblStatus->HoverTip = $objHoverTip;
         $strToReturn = $lblStatus->Render(false);
     } else {
         $strToReturn = '<strong style="color:#CC9933;">Pending</strong>';
     }
     return sprintf('%s', $strToReturn);
 }
开发者ID:brustj,项目名称:tracmor,代码行数:42,代码来源:Receipt.class.php


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