php将当前时间戳增加一年(year)

论坛 期权论坛 编程之家     
选择匿名的用户   2021-6-2 02:14   11   0
  1. echo strtotime("+1 year");//返回时间戳, 如果要转换成一般时间格式还需要下面的函数
  2. echo date('Y-m-d H:i:s', strtotime("+1 year"));
  3. ==============================================
  4. 同理,不仅仅可以+year 还可以是天, 月日都可以的,如下代码:
  5. <?php
  6. echo strtotime("now"), "\n";
  7. echo strtotime("10 September 2000"), "\n";
  8. echo strtotime("+1 day"), "\n";
  9. echo strtotime("+1 week"), "\n";
  10. echo strtotime("+1 week 2 days 4 hours 2 seconds"), "\n";
  11. echo strtotime("next Thursday"), "\n";
  12. echo strtotime("last Monday"), "\n";
  13. ?>
分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP