本文整理匯總了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;
}