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


PHP QDateTime::IsEqualTo方法代码示例

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


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

示例1: testSetProperties

 public function testSetProperties()
 {
     $obj1 = new QDateTime();
     $obj1->setDate(2002, 3, 15);
     $obj2 = new QDateTime("2002-03-15");
     $obj3 = new QDateTime("2002-03-15 13:15");
     $obj4 = new QDateTime("2002-03-16");
     $this->assertTrue($obj1->IsEqualTo($obj2));
     $this->assertTrue($obj1->IsEqualTo($obj3));
     // dates are the same!
     $this->assertFalse($obj3->IsEqualTo($obj4));
     // dates are different!
 }
开发者ID:tomVertuoz,项目名称:framework,代码行数:13,代码来源:QDateTimeTests.php

示例2: __get

 public function __get($strName)
 {
     switch ($strName) {
         case 'GeneratedDescription':
             if ($this->strLocation || $this->dttDateStart || $this->dttDateEnd) {
                 $strToReturn = ', to be held';
                 if ($this->strLocation) {
                     $strToReturn .= ' at ' . $this->strLocation;
                 }
                 if ($this->dttDateStart && $this->dttDateEnd) {
                     $dttCompare1 = new QDateTime($this->dttDateStart);
                     $dttCompare2 = new QDateTime($this->dttDateEnd);
                     $dttCompare1->SetTime(null, null, null);
                     $dttCompare2->SetTime(null, null, null);
                     if ($dttCompare1->IsEqualTo($dttCompare2)) {
                         $strToReturn .= ' on ' . $this->dttDateStart->ToString('MMMM D YYYY');
                         $strToReturn .= ' from ' . $this->dttDateStart->ToString('h:mm z');
                         $strToReturn .= ' to ' . $this->dttDateEnd->ToString('h:mm z');
                     } else {
                         $strToReturn .= ' from ' . $this->dttDateStart->ToString('MMMM D');
                         $strToReturn .= ' to ' . $this->dttDateEnd->ToString('MMMM D YYYY');
                     }
                 } else {
                     if ($this->dttDateStart) {
                         $strToReturn .= ' on ' . $this->dttDateStart->ToString('MMMM D YYYY');
                         if ($this->dttDateStart->Hour || $this->dttDateStart->Minute) {
                             $strToReturn .= ' @ ' . $this->dttDateStart->ToString('h:mm z');
                         }
                     } else {
                         if ($this->dttDateEnd) {
                             $strToReturn .= ' until ' . $this->dttDateEnd->ToString('MMMM D YYYY');
                             if ($this->dttDateStart->Hour || $this->dttDateEnd->Minute) {
                                 $strToReturn .= ' @ ' . $this->dttDateEnd->ToString('h:mm z');
                             }
                         }
                     }
                 }
                 return $strToReturn;
             } else {
                 return null;
             }
             break;
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
开发者ID:alcf,项目名称:chms,代码行数:51,代码来源:EventSignupForm.class.php

示例3: ScoreDobGenderMobileMatch

 /**
  * This will check and provide a "score" on a match against DOB, Gender and Mobile Phone Number.
  * The score returned will be anything from -2 to 3.
  * 
  * A point is given for any item that is positively matched.
  * The score is negative if there is any item that does NOT match.
  * 
  * In order for a match or non-match to take place, the data item needs to be defined on BOTH this person and in the data being passed in.
  * 
  * @param QDateTime $dttDateOfBirth optional
  * @param string $strGender optional
  * @param string $strMobilePhone optional
  * @return integer
  */
 public function ScoreDobGenderMobileMatch(QDateTime $dttDateOfBirth = null, $strGender = null, $strMobilePhone = null)
 {
     $intScore = 0;
     $blnNegativeFlag = false;
     if ($dttDateOfBirth && $this->DateOfBirth && !$this->DobGuessedFlag && !$this->DobYearApproximateFlag) {
         if ($dttDateOfBirth->IsEqualTo($this->DateOfBirth)) {
             $intScore++;
         } else {
             $blnNegativeFlag = true;
         }
     }
     if ($strGender && $this->Gender) {
         if (trim(strtoupper($strGender) == $this->Gender)) {
             $intScore++;
         } else {
             $blnNegativeFlag = true;
         }
     }
     if ($strMobilePhone && $this->CountPhones()) {
         $blnFound = false;
         foreach ($this->GetPhoneArray() as $objPhone) {
             if ($objPhone->PhoneTypeId != PhoneType::Home) {
                 if ($strMobilePhone == $objPhone->Number) {
                     $blnFound = true;
                 }
             }
         }
         if ($blnFound) {
             $intScore++;
         } else {
             $blnNegativeFlag = true;
         }
     }
     return $blnNegativeFlag ? -1 * $intScore : $intScore;
 }
开发者ID:alcf,项目名称:chms,代码行数:49,代码来源:Person.class.php

示例4: testSetProperties

 public function testSetProperties()
 {
     $obj1 = new QDateTime();
     $obj1->setDate(2002, 3, 15);
     $this->assertTrue($obj1->IsTimeNull(), "Setting only a date after null constructor keeps time null");
     $obj2 = new QDateTime("2002-03-15");
     $obj3 = new QDateTime("2002-03-15 13:15");
     $obj4 = new QDateTime("2002-03-16");
     $this->assertTrue($obj1->IsEqualTo($obj2));
     $this->assertTrue($obj1->IsEqualTo($obj3));
     // dates are the same!
     $this->assertFalse($obj3->IsEqualTo($obj4));
     // dates are different!
     $obj5 = new QDateTime('13:15:02', null, QDateTime::TimeOnlyType);
     $this->assertTrue($obj5->IsDateNull(), "Setting only a date after null constructor keeps time null");
     $obj6 = new QDateTime('2002-03-15 13:15:02');
     $obj1->SetTime($obj5);
     $this->assertFalse($obj1->IsTimeNull(), "Setting a time with object results in a change in null time status");
     $this->assertTrue($obj1->IsEqualTo($obj6), "SetTime correctly combines date only and time only values");
 }
开发者ID:vaibhav-kaushal,项目名称:qc-framework,代码行数:20,代码来源:QDateTimeTest.php


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