本文整理汇总了PHP中QDateTime::FromTimeOnly方法的典型用法代码示例。如果您正苦于以下问题:PHP QDateTime::FromTimeOnly方法的具体用法?PHP QDateTime::FromTimeOnly怎么用?PHP QDateTime::FromTimeOnly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDateTime
的用法示例。
在下文中一共展示了QDateTime::FromTimeOnly方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
protected function setUp()
{
$this->dttOne = new QDateTime();
$this->dttTwo = new QDateTime();
$this->arrTimes = array(QDateTime::FromTimeOnly('00:00:00'), QDateTime::FromTimeOnly('06:35:00'), QDateTime::FromTimeOnly('23:59:59'));
$this->arrDates = array(new QDateTime('1980-06-13'), new QDateTime('today'));
$this->arrDatetimes = array(new QDateTime('1980-06-13 04:34'), new QDateTime(QDateTime::Now));
}
示例2: GetColumn
public function GetColumn($strColumnName, $strColumnType = null)
{
if (array_key_exists($strColumnName, $this->strColumnArray)) {
if (is_null($this->strColumnArray[$strColumnName])) {
return null;
}
switch ($strColumnType) {
case QDatabaseFieldType::Bit:
return $this->strColumnArray[$strColumnName] ? true : false;
case QDatabaseFieldType::Blob:
case QDatabaseFieldType::Char:
case QDatabaseFieldType::VarChar:
return QType::Cast($this->strColumnArray[$strColumnName], QType::String);
case QDatabaseFieldType::Date:
case QDatabaseFieldType::DateTime:
return new QDateTime($this->strColumnArray[$strColumnName]);
case QDatabaseFieldType::Time:
return QDateTime::FromTimeOnly($this->strColumnArray[$strColumnName]);
case QDatabaseFieldType::Float:
return QType::Cast($this->strColumnArray[$strColumnName], QType::Float);
case QDatabaseFieldType::Integer:
return QType::Cast($this->strColumnArray[$strColumnName], QType::Integer);
default:
return $this->strColumnArray[$strColumnName];
}
} else {
return null;
}
}
示例3: GetColumn
public function GetColumn($strColumnName, $strColumnType = null)
{
if (array_key_exists($strColumnName, $this->strColumnArray)) {
if (is_null($this->strColumnArray[$strColumnName])) {
return null;
}
switch ($strColumnType) {
case QDatabaseFieldType::Bit:
// Account for single bit value
$chrBit = $this->strColumnArray[$strColumnName];
if (strlen($chrBit) == 1 && ord($chrBit) == 0) {
return false;
}
// Otherwise, use PHP conditional to determine true or false
return $this->strColumnArray[$strColumnName] ? true : false;
case QDatabaseFieldType::Blob:
case QDatabaseFieldType::Char:
case QDatabaseFieldType::VarChar:
return QType::Cast($this->strColumnArray[$strColumnName], QType::String);
case QDatabaseFieldType::Date:
case QDatabaseFieldType::DateTime:
return new QDateTime($this->strColumnArray[$strColumnName]);
case QDatabaseFieldType::Time:
return QDateTime::FromTimeOnly($this->strColumnArray[$strColumnName]);
case QDatabaseFieldType::Float:
return QType::Cast($this->strColumnArray[$strColumnName], QType::Float);
case QDatabaseFieldType::Integer:
return QType::Cast($this->strColumnArray[$strColumnName], QType::Integer);
default:
return $this->strColumnArray[$strColumnName];
}
} else {
return null;
}
}