用PHP添加一年到日期时间 [英] add one year to datetime with php

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

问题描述

$data['user']['time'] = '2011-03-07 00:33:45';    

我们如何将1年添加到该日期?

how can we add 1 year to this date ?

类似于$newdata = $data['user']['time'] + 1 year吗?

$newdata = 2012-03-07 00:33:45

谢谢

亚当·拉马丹

推荐答案

strtotime() 是您的功能重新寻找:

strtotime() is the function you're looking for:

$data['user']['seal_data'] = date('Y-m-d H:i:s', strtotime('+1 year', strtotime($data['user']['time'])));

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

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