本文整理汇总了PHP中TimeDate::get_gmt_db_datetime方法的典型用法代码示例。如果您正苦于以下问题:PHP TimeDate::get_gmt_db_datetime方法的具体用法?PHP TimeDate::get_gmt_db_datetime怎么用?PHP TimeDate::get_gmt_db_datetime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeDate
的用法示例。
在下文中一共展示了TimeDate::get_gmt_db_datetime方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testUserDateFormat
public function testUserDateFormat()
{
$gmt_default_date_start = $this->time_date->get_gmt_db_datetime();
$date1 = $this->time_date->handle_offset($gmt_default_date_start, $GLOBALS['timedate']->get_date_time_format());
$date2 = $this->time_date->asUser($this->time_date->getNow());
$this->assertEquals($date1, $date2, "HandleOffset should be equaivalent to nowDb");
}
示例2: eval
function get_parameter_value($rp, $rpl)
{
global $current_language, $current_user;
if ($rp->range_name == "CURRENT_USER") {
return $current_user->id;
} else {
if ($rp->range_name == "SCRIPT") {
return eval($rp->range_options);
} else {
if ($rp->range_name == "DATE") {
$timedate = new TimeDate();
$result = $timedate->to_db_date($_REQUEST[$rpl->name], false);
return $result;
} else {
if ($rp->range_name == "DATE_NOW") {
$timedate = new TimeDate();
$result = $timedate->get_gmt_db_datetime();
return $result;
} else {
if ($rp->range_name == "DATE_ADD" || $rp->range_name == "DATE_SUB") {
$timedate = new TimeDate();
$arr = split("::", $_REQUEST[$rpl->name]);
if (count($arr) == 2) {
$count = $arr[0];
$type = $arr[1];
if ($type == "MINUTE") {
$count *= 60;
} else {
if ($type == "HOUR") {
$count *= 60 * 60;
} else {
if ($type == "DAY") {
$count *= 60 * 60 * 24;
} else {
if ($type == "WEEK") {
$count *= 60 * 60 * 24 * 7;
} else {
if ($type == "MONTH") {
$count *= 60 * 60 * 24 * 30;
} else {
if ($type == "YEAR") {
$count *= 60 * 60 * 24 * 365;
}
}
}
}
}
}
if ($rp->range_name == "DATE_SUB") {
$count *= -1;
}
} else {
$count = 0;
}
$time = time();
$time += $count;
$result = date('Y-m-d H:i:s', $time);
$result = $timedate->to_db($result);
return $result;
} else {
return $_REQUEST[$rpl->name];
}
}
}
}
}
}