本文整理匯總了PHP中TimeDate::to_db_date_time方法的典型用法代碼示例。如果您正苦於以下問題:PHP TimeDate::to_db_date_time方法的具體用法?PHP TimeDate::to_db_date_time怎麽用?PHP TimeDate::to_db_date_time使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TimeDate
的用法示例。
在下文中一共展示了TimeDate::to_db_date_time方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testToDbDateTimeFormats
/**
* test conversion from local date+time to DB date+time, no TZ handling
* @dataProvider dateTestSet
*/
public function testToDbDateTimeFormats($db, $df, $tf, $tz, $display, $dbdate)
{
$tf = empty($tf) ? self::DEFAULT_TIME_FORMAT : $tf;
$this->_setPrefs($df, $tf, $tz);
$dt = explode(' ', $display);
if (count($dt) > 1) {
list($date, $time) = $dt;
} else {
$date = $dt[0];
$z = new DateTime("@0", new DateTimeZone("GMT"));
$time = $z->format($tf);
}
$this->assertEquals(explode(' ', $dbdate), $this->time_date->to_db_date_time($date, $time), "Broken conversion for '{$df} {$tf}' with date '{$display}' and TZ {$tz}");
}