dongzhenju3015 2019-03-18 09:16
浏览 56

如何从下周的某天在php中获取日期

I´d like to print out date from day of week and right now I´m using the following string to get date from monday:

$current_dayname = date("l");
echo $date = date("Y-m-d",strtotime('monday this week'));

It works and on monday morning I´ll get the date from monday. Now what I´d like to accomplish is to print out the date from next monday already on saturday. How can I accomplish that?

  • 写回答

1条回答 默认 最新

  • dpy15285 2019-03-19 12:47
    关注

    You can try the code below:

    echo $date = date("Y-m-d",strtotime('monday next week'));
    

    This should give you the date of the following Monday.

    This will also work:

    echo $date = date("Y-m-d",strtotime('monday this week +1 week'));
    
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度