doubomudichen0832 2013-12-31 09:27
浏览 27

Codeigniter日历库显示周和月

i'm searching a way to display data for week and month.

For now, i can click on a day of the calendar and see the data related to this day.

For example, i'd like to choose the week number 5(or a month) of year 2013 and see the data related.

Any idea of how to do it?

Thank you.

  • 写回答

1条回答 默认 最新

  • douchuang1852 2013-12-31 10:33
    关注

    i found out the solution:

    My controller script:

    $p = new DatePeriod(
    new DateTime('2013-09-01'), 
    new DateInterval('P1W'), 
    new DateTime($today)
    );
    $data['weeks'] = array();
    $data['month'] = array();
    foreach ($p as $w) {
    $data['weeks'][$w->format('W')] = $w->format('Y').' - Week '.$w->format('W');
    $data['month'][$w->format('m')] = $w->format('Y').' - Month '.$w->format('m');
    }
    

    My view script:

    <?php
    // display for weeks
    echo form_dropdown('week', $weeks, $lastWeek);
    // display for month
    echo form_dropdown('month', $month, $lastMonth);
    ?>
    
    评论

报告相同问题?

悬赏问题

  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?