本文整理汇总了PHP中TiendaHelperBase::local_to_GMT_data方法的典型用法代码示例。如果您正苦于以下问题:PHP TiendaHelperBase::local_to_GMT_data方法的具体用法?PHP TiendaHelperBase::local_to_GMT_data怎么用?PHP TiendaHelperBase::local_to_GMT_data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TiendaHelperBase
的用法示例。
在下文中一共展示了TiendaHelperBase::local_to_GMT_data方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getData
/**
* Override parent::_getData() to insert groupBy and orderBy clauses into query
*
* @return unknown_type
*/
function _getData()
{
$state = $this->_getState();
$order_states = array('3', '5', '17');
$filter_date_from = $state['filter_date_from'];
$filter_date_to = $state['filter_date_to'];
if (empty($filter_date_to) and empty($filter_date_from)) {
$date = JFactory::getDate();
$today = $date->toFormat("%Y-%m-%d 00:00:00");
$filter_date_to = $today;
$database = JFactory::getDBO();
$query = " SELECT DATE_SUB('" . $today . "', INTERVAL 1 MONTH) ";
$database->setQuery($query);
$filter_date_from = $database->loadResult();
} else {
if (empty($filter_date_to) and !empty($filter_date_from)) {
$filter_date_to = $filter_date_from;
} else {
if (!empty($filter_date_to) and empty($filter_date_from)) {
$filter_date_from = $filter_date_to;
}
}
}
$date_tmp = date_create($filter_date_to);
date_modify($date_tmp, '24 hour');
$database = JFactory::getDBO();
$curdate = TiendaHelperBase::local_to_GMT_data($filter_date_from);
$enddate = TiendaHelperBase::local_to_GMT_data(date_format($date_tmp, 'Y-m-d H:i:s'));
while ($curdate < $enddate) {
// set working variables
$variables = TiendaHelperBase::setDateVariables($curdate, $enddate, 'daily');
$thisdate = $variables->thisdate;
$nextdate = $variables->nextdate;
$query = new TiendaQuery();
$query->select('COUNT(tbl.order_id) AS num, SUM(order_total) AS amount');
$query->from('#__tienda_orders AS tbl');
$query->where("tbl.order_state_id IN (" . $this->getStatesCSV() . ")");
$query->where("tbl.modified_date >= '" . $curdate . "'");
$query->where("tbl.modified_date <= '" . $nextdate . "'");
$database->setQuery((string) $query);
$return_daily_report = $database->loadObject();
$date_tmp = date_create(TiendaHelperBase::GMT_to_local_data($curdate));
$data_print = date_format($date_tmp, 'd-m-Y');
$return_range_report->{$data_print} = $return_daily_report;
// increase curdate to the next value
$curdate = $nextdate;
}
return $return_range_report;
}
示例2: getCorrectBeginDayTime
/**
* Method which gets a correct time of beginning of a day with respect to the current time zone
*
* @param $date Joomla JDate object
*
* @return Correct Datetime with respect to the current time zone
*/
function getCorrectBeginDayTime($date)
{
$date_gmt = $date;
if (is_object($date_gmt)) {
$date_gmt = $date_gmt->toFormat("%Y-%m-%d %H:%M:%S");
}
$date_local = TiendaHelperBase::GMT_to_local_data((string) $date_gmt);
$startdate_gmt = date_format(date_create($date_local), 'Y-m-d 00:00:00');
return TiendaHelperBase::local_to_GMT_data($startdate_gmt);
}