PHP日期加上5年到当前日期 [英] PHP date add 5 year to current date

查看:340
本文介绍了PHP日期加上5年到当前日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下PHP代码:

$end=date('Y-m-d');

我用它来获取当前日期,而我需要未来5年的日期,例如:

I use it to get the current date, and I need the date 5 years in the future, something like:

$end=date('(Y + 5)-m-d');

我该怎么做?

推荐答案

尝试使用:

$end = date('Y-m-d', strtotime('+5 years'));

这篇关于PHP日期加上5年到当前日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆