当前位置: 首页>>代码示例>>PHP>>正文


PHP TimeHelper::daysAsSql方法代码示例

本文整理汇总了PHP中TimeHelper::daysAsSql方法的典型用法代码示例。如果您正苦于以下问题:PHP TimeHelper::daysAsSql方法的具体用法?PHP TimeHelper::daysAsSql怎么用?PHP TimeHelper::daysAsSql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TimeHelper的用法示例。


在下文中一共展示了TimeHelper::daysAsSql方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: TimeHelper

 function _isLastMonth()
 {
     App::import('Helper', 'Time');
     $time = new TimeHelper();
     $last_month[0] = date('Y-m-01', strtotime('-1 month'));
     $last_month[1] = date(DATE_W3C, mktime(0, 0, 0, date('m'), 0, date('y')));
     $q = $time->daysAsSql($last_month[0], $last_month[1], 'modified');
     $res = false;
     if ($this->SbmRanking->hasAny($q)) {
         $res = true;
     }
     return $res;
 }
开发者ID:hide99,项目名称:sbmranking,代码行数:13,代码来源:sbmranking.php

示例2: TimeHelper

 function admin_order_report()
 {
     $time = new TimeHelper();
     if (!empty($this->data)) {
         //pr($this->data);
         if (@$this->data['Order']['option'] == 'today') {
             $todayStart = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
             $this->paginate = array('conditions' => array($time->daysAsSql($todayStart, time(), 'Order.od_date')));
             $orders = $this->paginate();
             $countNum = count($orders);
             $this->set('orders', $orders);
             $this->set('totalNum', $countNum);
             if ($countNum == 0) {
                 $totalSum = 0.0;
             } else {
                 $totalSum = $this->Order->get_total_payed_orders_sum($orders);
             }
             $this->set('totalSum', $totalSum);
         } elseif (@$this->data['Order']['option'] == 'yesterday') {
             $yesterdayStart = mktime(0, 0, 0, date('m'), date('d') - 1, date('Y'));
             $yesterdayEnd = mktime(23, 59, 0, date('m'), date('d') - 1, date('Y'));
             //pr(date('Y-m-d H:i:s',$yesterdayStart));
             //die;
             $this->paginate = array('conditions' => array('Order.od_date >' => date('Y-m-d H:i:s', $yesterdayStart), 'Order.od_date <' => date('Y-m-d H:i:s', $yesterdayEnd)));
             //$this->paginate = array('conditions' => array($time->daysAsSql($yesterdayStart, $yesterdayEnd, 'Order.od_date')));
             $orders = $this->paginate();
             $countNum = count($orders);
             if ($countNum == 0) {
                 $totalSum = 0.0;
             } else {
                 $totalSum = $this->Order->get_total_payed_orders_sum($orders);
             }
             $this->set('totalSum', $totalSum);
             $this->set('orders', $orders);
             $this->set('totalNum', $countNum);
         } elseif ($this->data['Order']['option'] == 'last week') {
         } else {
             $hour = $this->data['Order']['startDate']['hour'];
             $minute = $this->data['Order']['startDate']['min'];
             $year = $this->data['Order']['startDate']['year'];
             $month = $this->data['Order']['startDate']['month'];
             $day = $this->data['Order']['startDate']['day'];
             $start = @mktime($hour, $minute, 0, $month, $day, $year);
             $hour = $this->data['Order']['endDate']['hour'];
             $minute = $this->data['Order']['endDate']['min'];
             $year = $this->data['Order']['endDate']['year'];
             $month = $this->data['Order']['endDate']['month'];
             $day = $this->data['Order']['endDate']['day'];
             $end = @mktime($hour, $minute, 0, $month, $day, $year);
             $this->paginate = array('conditions' => array($time->daysAsSql($start, $end, 'Order.od_date'), 'Order.od_status' => 'Completed'));
             $orders = $this->paginate();
             $countNum = count($orders);
             $this->set('orders', $orders);
             $this->set('totalNum', $countNum);
             $totalSum = $this->Order->get_total_payed_orders_sum($orders);
             $this->set('totalSum', $totalSum);
         }
     }
     //Y-m-d H:i:s
     mktime();
     $beginningDay = mktime(0, 0, 0, 8, 2, 2011);
     /*
     pr($now);
     pr($time->format('Y-m-d H:i:s',$now));
     pr($beginningDay);
     pr($time->format('Y-m-d H:i:s',$beginningDay));
     $timeElapsed = time() - $beginningDay;
     pr(date('H:i:s', $timeElapsed));
     
     pr($timeElapsed/60/60);
     //die;
     
     $orders = $this->Order->find('all', array('conditions' => array($time->daysAsSql($beginningDay, time(), 'Order.od_date'))));
     $totalSum = $this->Order->get_total_payed_orders_sum($orders);
     $this->set('orders', $orders);
     */
 }
开发者ID:johnulist,项目名称:ecommerce,代码行数:77,代码来源:orders_controller.php


注:本文中的TimeHelper::daysAsSql方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。