dongpai2754 2014-07-17 22:24
浏览 20
已采纳

添加60天到预定义的日期字符串[重复]

This question already has an answer here:

Okay, so I have a predefined date getting pulled from a database that looks like this: 2014-06-17 and I need to add 60 days to that specified day.

My code is as below: but it currently echoes out the same day for both result and accept.

What is wrong?

$result = $this->employment->verify($data);

        echo $result.'<br/>';

        $accept = date('Y-m-d', strtotime("+60 days", $result));

        echo $accept.'<br/>';

        return false;
</div>
  • 写回答

3条回答 默认 最新

  • dongyirong3564 2014-07-17 22:28
    关注

    strtotime needs a UNIX timestamp as the second argument:

    $accept = date('Y-m-d', strtotime("+60 days", strtotime($result)));
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法