本文整理汇总了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!
}
示例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;
}
}
}
示例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;
}
示例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");
}