doushao8399 2013-12-24 10:16
浏览 28
已采纳

用PHP获取下个月

I have a php calendar that works fine for THIS month but I'd like to create another 2 scripts that show the next 2 months. I want to use the same format as the one I already have but I'm not completely sure on what I need to change to get it to display the dates of months 2 & 3. Here is my code for Month 1:

<?php 
    $currDay        =    date("j");
    $today          =    date("d"); // Current day
    $month          =    date("m"); // Current month
    $displaymonth   =    date("F");
    $year           =    date("Y"); // Current year

    // Days in current month
    $days           =    cal_days_in_month(CAL_GREGORIAN,$month,$year);
?>

Can anyone help me with this?

  • 写回答

3条回答 默认 最新

  • dsds661730652211 2013-12-24 11:08
    关注
    $firstMonth= date('F', strtotime('+1 months'));
    $secondMonth= date('F', strtotime('+1 months'));
    

    strtotime returns timestamp for next and date('F') will convert it to your desired format.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python