本文整理汇总了PHP中TimeDate::nowDb方法的典型用法代码示例。如果您正苦于以下问题:PHP TimeDate::nowDb方法的具体用法?PHP TimeDate::nowDb怎么用?PHP TimeDate::nowDb使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeDate
的用法示例。
在下文中一共展示了TimeDate::nowDb方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testHandleOffset
public function testHandleOffset()
{
$gmt_today = $this->time_date->nowDb();
$date1 = $this->time_date->handle_offset($gmt_today, $GLOBALS['timedate']->get_db_date_time_format());
$date2 = $this->time_date->nowDb();
$this->assertEquals($date1, $date2, "HandleOffset should be equaivalent to nowDb");
}
示例2: testGetDB
/**
* test getting DB date formats indifferent ways
*/
public function testGetDB()
{
$this->assertEquals(gmdate($this->time_date->merge_date_time($this->time_date->get_db_date_format(), $this->time_date->get_db_time_format())), $this->time_date->nowDb());
}
示例3: track_slow_queries
/**
* Tracks slow queries in the tracker database table
*
* @param string $query value of query to track
*/
protected function track_slow_queries($query)
{
$trackerManager = TrackerManager::getInstance();
if ($trackerManager->isPaused()) {
return;
}
if ($monitor = $trackerManager->getMonitor('tracker_queries')) {
$monitor->setValue('date_modified', $this->timedate->nowDb());
$monitor->setValue('text', $query);
$monitor->setValue('sec_total', $this->query_time);
//Save the monitor to cache (do not flush)
$trackerManager->saveMonitor($monitor, false);
}
}
示例4: handleDateFormat
/**
* handles some date/time foramtting
* @param string time Time (usually "now")
* @param object user User, usually admin (id = '1')
* @param boolean to_local, convert to user's time format
* @return string formatted time.
*/
function handleDateFormat($time, $user = null, $to_local = true)
{
global $timedate;
if (!isset($timedate) || empty($timedate)) {
$timedate = new TimeDate();
}
// get proper user
$user = empty($user) ? $this->user : $user;
$dbTime = $timedate->nowDb();
if ($to_local) {
$ret = $timedate->to_display_date_time($dbTime, true, true, $user);
return $ret;
}
return $dbTime;
}