本文整理汇总了PHP中DateTimeUtil::get_mysql_date方法的典型用法代码示例。如果您正苦于以下问题:PHP DateTimeUtil::get_mysql_date方法的具体用法?PHP DateTimeUtil::get_mysql_date怎么用?PHP DateTimeUtil::get_mysql_date使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateTimeUtil
的用法示例。
在下文中一共展示了DateTimeUtil::get_mysql_date方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
function get_occurs_within_where_clause($table_name, $rel_table, $start_ts_obj, $end_ts_obj, $field_name = 'date_start', $view)
{
global $timedate;
$dtUtilArr = array();
switch ($view) {
case 'month':
$start_ts = $start_ts_obj->get_first_day_of_this_month();
$end_ts = $end_ts_obj->get_first_day_of_next_month();
break;
default:
// Date for the past 5 days as that is the maximum duration of a single activity
$dtUtilArr['ts'] = $start_ts_obj->ts - 86400 * 5;
$start_ts = new DateTimeUtil($dtUtilArr, false);
// Date for the next 5 days as that is the maximum duration of a single activity
$dtUtilArr['ts'] = $end_ts_obj->ts + 86400 * 5;
$end_ts = new DateTimeUtil($dtUtilArr, false);
break;
}
$start_mysql_date = explode('-', $start_ts->get_mysql_date());
$start_mysql_date_time = explode(' ', $timedate->handle_offset(date($GLOBALS['timedate']->get_db_date_time_format(), $start_ts->ts), $timedate->dbDayFormat, true));
$end_mysql_date = explode('-', $end_ts->get_mysql_date());
$end_mysql_date_time = explode(' ', $timedate->handle_offset(date($GLOBALS['timedate']->get_db_date_time_format(), $end_ts->ts), $timedate->dbDayFormat, true));
$where = "(" . db_convert($table_name . '.' . $field_name, 'date_format', array("'%Y-%m-%d'"), array("'YYYY-MM-DD'")) . " >= '{$start_mysql_date_time[0]}' AND ";
$where .= db_convert($table_name . '.' . $field_name, 'date_format', array("'%Y-%m-%d'"), array("'YYYY-MM-DD'")) . " <= '{$end_mysql_date_time[0]}')";
if ($rel_table != '') {
$where .= ' AND ' . $rel_table . '.accept_status != \'decline\'';
}
return $where;
}