TypechoJoeTheme

Dcr163的博客

统计

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

2018-12-02
/
0 评论
/
1,215 阅读
/
正在检测是否收录...
12/02


echo strtotime("+1 year");//返回时间戳, 如果要转换成一般时间格式还需要下面的函数

echo date('Y-m-d H:i:s', strtotime("+1 year"));

==============================================

同理,不仅仅可以+year   还可以是天, 月日都可以的,如下代码:

<?php
    echo strtotime("now"), "\n";
    echo strtotime("10 September 2000"), "\n";
    echo strtotime("+1 day"), "\n";
    echo strtotime("+1 week"), "\n";
    echo strtotime("+1 week 2 days 4 hours 2 seconds"), "\n";
    echo strtotime("next Thursday"), "\n";
    echo strtotime("last Monday"), "\n";
    echo date("Y-m-d", strtotime("+1 months", strtotime("2010-10-06"))), "\n";
?>

转自:http://www.thinkphp.cn/code/2824.html

朗读
赞(0)
版权属于:

Dcr163的博客

本文链接:

https://www.dcr163.cn/194.html(转载时请注明本文出处及文章链接)

评论 (0)

人生倒计时

今日已经过去小时
这周已经过去
本月已经过去
今年已经过去个月

最新回复

  1. https://Sites.google.com/view/vavada-online-casino
    2025-04-12
  2. https://x.com/jeetbuzzcom
    2025-04-07
  3. prozone.cc alternative
    2025-03-19
  4. urgent delivery
    2025-03-16
  5. faster indexing
    2025-03-05

标签云