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


PHP Common::formatDate方法代码示例

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


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

示例1: getXAxisDates

 private static function getXAxisDates($date_range_dates, $format)
 {
     $previous_formated = array();
     $x_axis_dates = array();
     foreach ($date_range_dates as $date) {
         $formated = Common::formatDate($date, $format);
         if (!in_array($formated, $previous_formated)) {
             array_push($x_axis_dates, array('date' => $date, 'label' => $formated));
         }
         $previous_formated[] = $formated;
     }
     return $x_axis_dates;
 }
开发者ID:wanyos2005,项目名称:hsbf,代码行数:13,代码来源:HighCharts.php

示例2: afterFind

 public function afterFind()
 {
     $this->name = $this->first_name . " " . $this->last_name;
     if (!empty($this->birthdate)) {
         $this->birthdate_day = Common::formatDate($this->birthdate, 'd');
         $this->birthdate_month = Common::formatDate($this->birthdate, 'm');
         $this->birthdate_year = Common::formatDate($this->birthdate, 'Y');
     }
     return parent::afterFind();
 }
开发者ID:jacjimus,项目名称:furahia_mis,代码行数:10,代码来源:Person.php

示例3: getStats

 /**
  * Get stats
  * @param string $durationType e.g today,this_week,this_month,this_year, defaults to null (all time)
  * @param array $filters $key=>$value pair where the $key is the table field and $value is the table value: empty by default
  * @param mixed $sum if false then the count is return else returns the sum of the $sum field: defaults to FALSE
  * @param string $dateField The date field of the table to be queried for duration stats. defaults to "date_created"
  * @param string $from date_range from
  * @param string $to date_range to
  * @param type $conditions
  * @return integer count or sum
  */
 public function getStats($durationType = '', $filters = array(), $sum = false, $dateField = 'date_created', $from = null, $to = null, $conditions = '')
 {
     $today = date('Y-m-d');
     $this_month = date('m');
     $this_year = date('Y');
     $params = array();
     foreach ($filters as $k => $v) {
         if ($this->hasAttribute($k)) {
             if (!empty($conditions)) {
                 $conditions .= ' AND ';
             }
             $conditions .= '`' . $k . '`=:' . $k;
             $params[':' . $k] = $v;
         }
     }
     switch ($durationType) {
         case self::STATS_TODAY:
             if (!empty($conditions)) {
                 $conditions .= ' AND ';
             }
             $conditions .= 'DATE(`' . $dateField . '`)=:' . $dateField;
             $params[':' . $dateField] = $today;
             break;
         case self::STATS_THIS_WEEK:
             if (!empty($conditions)) {
                 $conditions .= ' AND ';
             }
             $conditions .= 'YEARWEEK(`' . $dateField . '`,1)=YEARWEEK(:' . $dateField . ',1)';
             $params[':' . $dateField] = $today;
             break;
         case self::STATS_LAST_WEEK:
             if (!empty($conditions)) {
                 $conditions .= ' AND ';
             }
             $conditions .= 'YEARWEEK(`' . $dateField . '`,1)=YEARWEEK(:' . $dateField . ',1)';
             $params[':' . $dateField] = Common::addDate($today, '-7', 'day');
             break;
         case self::STATS_THIS_MONTH:
             if (!empty($conditions)) {
                 $conditions .= ' AND ';
             }
             $conditions .= 'YEAR(`' . $dateField . '`)=:' . $dateField . '_Y AND MONTH(`' . $dateField . '`)=:' . $dateField . '_M';
             $params[':' . $dateField . '_Y'] = $this_year;
             $params[':' . $dateField . '_M'] = $this_month;
             break;
         case self::STATS_LAST_MONTH:
             if (!empty($conditions)) {
                 $conditions .= ' AND ';
             }
             $conditions .= 'YEAR(`' . $dateField . '`)=:' . $dateField . '_Y AND MONTH(`' . $dateField . '`)=:' . $dateField . '_M';
             $date = Common::addDate($today, '-1', 'month');
             $year = Common::formatDate($date, 'Y', false);
             $month = Common::formatDate($date, 'm', false);
             $params[':' . $dateField . '_Y'] = $year;
             $params[':' . $dateField . '_M'] = $month;
             break;
         case self::STATS_THIS_YEAR:
             if (!empty($conditions)) {
                 $conditions .= ' AND ';
             }
             $conditions .= 'YEAR(`' . $dateField . '`)=:' . $dateField . '_Y';
             $params[':' . $dateField . '_Y'] = $this_year;
             break;
         case self::STATS_LAST_YEAR:
             if (!empty($conditions)) {
                 $conditions .= ' AND ';
             }
             $conditions .= 'YEAR(`' . $dateField . '`)=:' . $dateField . '_Y';
             $date = Common::addDate($today, '-1', 'year');
             $params[':' . $dateField . '_Y'] = Common::formatDate($date, 'Y', false);
             break;
         case self::STATS_DATE_RANGE:
             if (empty($from) || empty($to)) {
                 throw new CHttpException(500, '$from and $to params not given.');
             }
             if (!empty($conditions)) {
                 $conditions .= ' AND ';
             }
             $conditions .= '(DATE(`' . $dateField . '`)>=:from AND DATE(`' . $dateField . '`)<=:to)';
             $params[':from'] = $from;
             $params[':to'] = $to;
             break;
     }
     if ($sum) {
         return $this->getSum($sum, $conditions, $params);
     } else {
         return $this->getTotals($conditions, $params);
     }
 }
开发者ID:jacjimus,项目名称:furahia_mis,代码行数:100,代码来源:ActiveRecord.php

示例4: array

        <h4 class="panel-title">
            <i class="fa fa-chevron-down"></i> <a data-toggle="collapse" data-parent="#accordion" href="#personal_info"><?php 
echo Lang::t('Personal Information');
?>
</a>
            <?php 
if ($can_update || Users::isMyAccount($model->id)) {
    ?>
                <span><a class="pull-right" href="<?php 
    echo $this->createUrl('view', array('id' => $model->id, 'action' => Users::ACTION_UPDATE_PERSONAL));
    ?>
"><i class="fa fa-edit"></i> <?php 
    echo Lang::t('Edit');
    ?>
</a></span>
            <?php 
}
?>
        </h4>
    </div>
    <div id="personal_info" class="panel-collapse collapse">
        <div class="panel-body">
            <div class="detail-view">
                <?php 
$this->widget('application.components.widgets.DetailView', array('data' => $model, 'attributes' => array(array('name' => 'first_name'), array('name' => 'last_name'), array('name' => 'gender'), array('name' => 'birthdate', 'value' => Common::formatDate($model->birthdate, 'd M Y'), 'visible' => !empty($model->birthdate)), array('name' => 'idno'), array('name' => 'married'))));
?>
            </div>
        </div>
    </div>
</div>
开发者ID:wanyos2005,项目名称:hsbf,代码行数:30,代码来源:_view_personal.php

示例5: array

                <h4 class="panel-title">
                        <i class="fa fa-chevron-down"></i> <a data-toggle="collapse" data-parent="#accordion" href="#personal_info"><?php 
echo Lang::t('Employment Details');
?>
</a>
                        <?php 
if ($can_update || Users::isMyAccount($model->id)) {
    ?>
                                <span><a class="pull-right" href="<?php 
    echo $this->createUrl('view', array('id' => $model->id, 'action' => Users::ACTION_UPDATE_PERSONAL));
    ?>
"><i class="fa fa-edit"></i> <?php 
    echo Lang::t('Edit');
    ?>
</a></span>
                        <?php 
}
?>
                </h4>
        </div>
        <div id="personal_info" class="panel-collapse collapse">
                <div class="panel-body">
                        <div class="detail-view">
                                <?php 
$this->widget('application.components.widgets.DetailView', array('data' => $model, 'attributes' => array(array('name' => 'staff_no'), array('name' => 'level'), array('name' => 'title'), array('name' => 'employment_date', 'value' => Common::formatDate($model->employment_date, 'd M Y'), 'visible' => !empty($model->employment_date)), array('name' => 'marriage_status'), array('name' => 'nssf_no'), array('name' => 'nhif_no'), array('name' => 'location'), array('name' => 'department'), array('name' => 'birthdate', 'value' => Common::formatDate($model->birthdate, 'd M Y'), 'visible' => !empty($model->birthdate)), array('name' => 'status', 'value' => CHtml::tag('span', array('class' => $model->status === Staff::STATUS_ACTIVE ? 'badge badge-success' : 'badge badge-danger'), $model->status), 'type' => 'raw'))));
?>
                        </div>
                </div>
        </div>
</div>
开发者ID:jacjimus,项目名称:furahia_mis,代码行数:30,代码来源:_view_employment.php

示例6:

                                <span class="msg-title">
                                        <span class="blue"><?php 
    echo CHtml::encode($row['from']);
    ?>
</span><br/>
                                        <?php 
    echo MyYiiUtils::myShortenedString($row['message'], 20, " ...", 20);
    ?>
                                </span>
                                <span class="msg-time">
                                        <i class="icon-time"></i>
                                        <time class="timeago" datetime="<?php 
    echo $localtime;
    ?>
"><?php 
    echo Common::formatDate($localtime);
    ?>
</time>
                                </span>
                        </span>
                </a>
        </li>
<?php 
}
?>
<li><a href="<?php 
echo Yii::app()->createUrl('msg/message/inbox');
?>
"><?php 
echo Lang::t('See all messages');
?>
开发者ID:wanyos2005,项目名称:hsbf,代码行数:31,代码来源:_topbar_messages_list.php

示例7: array

echo $this->showLink(Users::USER_RESOURCE_PREFIX . $user->user_level) ? CHtml::link($avator, Yii::app()->createUrl('users/user/view', array('id' => $user->id)), array('class' => '')) : $avator;
?>
                        &nbsp;
                        <?php 
echo CHtml::link($user->id !== Yii::app()->user->id ? CHtml::encode($user->name) : Lang::t('Me'), $this->createUrl('view', array('id' => $data->id)), array('class' => 'sender'));
?>
                        &nbsp;
                        <i class="icon-time bigger-110 orange middle"></i>
                        <span class="time"><abbr title="<?php 
echo Common::formatDate($data->date_created);
?>
"><time class="timeago" datetime="<?php 
echo $data->date_created;
?>
"><?php 
echo Common::formatDate($data->date_created);
?>
</time></abbr></span>
                </div>

                <div class="action-buttons pull-right">
                        <a href="#">
                                <i class="icon-reply green icon-only bigger-130"></i>
                        </a>
                        <a href="#">
                                <i class="icon-trash red icon-only bigger-130"></i>
                        </a>
                </div>
        </div>
        <div class="message-body">
                <?php 
开发者ID:wanyos2005,项目名称:hsbf,代码行数:31,代码来源:_thread_list.php


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