本文整理汇总了PHP中QDateTime::IsNull方法的典型用法代码示例。如果您正苦于以下问题:PHP QDateTime::IsNull方法的具体用法?PHP QDateTime::IsNull怎么用?PHP QDateTime::IsNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDateTime
的用法示例。
在下文中一共展示了QDateTime::IsNull方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testIncompleteDates
public function testIncompleteDates()
{
$obj1 = new QDateTime("Feb 12");
$this->assertFalse($obj1->IsNull());
$this->assertFalse($obj1->IsDateNull());
$this->assertTrue($obj1->IsTimeNull());
$obj2 = new QDateTime("March 2003");
$this->assertFalse($obj2->IsNull());
$this->assertFalse($obj2->IsDateNull());
$this->assertTrue($obj2->IsTimeNull());
}
示例2: __set
public function __set($strName, $mixValue)
{
switch ($strName) {
case 'MaxDate':
case 'Maximum':
try {
if (is_string($mixValue)) {
$mixValue = new QDateTime($mixValue);
}
parent::__set('MaxDate', QType::Cast($mixValue, QType::DateTime));
} catch (QInvalidCastException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
break;
case 'MinDate':
case 'Minimum':
try {
if (is_string($mixValue)) {
$mixValue = new QDateTime($mixValue);
}
parent::__set('MinDate', QType::Cast($mixValue, QType::DateTime));
} catch (QInvalidCastException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
break;
case 'DateTime':
try {
$this->dttDateTime = QType::Cast($mixValue, QType::DateTime);
if ($this->dttDateTime && $this->dttDateTime->IsNull()) {
$this->dttDateTime = null;
$this->blnModified = true;
}
if (!$this->dttDateTime || !$this->strDateTimeFormat) {
parent::__set('Text', '');
} else {
parent::__set('Text', $this->dttDateTime->qFormat($this->strDateTimeFormat));
}
} catch (QInvalidCastException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
break;
case 'JqDateFormat':
try {
parent::__set($strName, $mixValue);
$this->strDateTimeFormat = QCalendar::qcFrmt($this->JqDateFormat);
// trigger an update to reformat the text with the new format
$this->DateTime = $this->dttDateTime;
} catch (QInvalidCastException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
break;
case 'DateTimeFormat':
case 'DateFormat':
try {
$this->strDateTimeFormat = QType::Cast($mixValue, QType::String);
parent::__set('JqDateFormat', QCalendar::jqFrmt($this->strDateTimeFormat));
// trigger an update to reformat the text with the new format
$this->DateTime = $this->dttDateTime;
} catch (QInvalidCastException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
break;
case 'Text':
parent::__set($strName, $mixValue);
$this->dttDateTime = new QDateTime($this->strText);
break;
default:
try {
parent::__set($strName, $mixValue);
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
break;
}
}