本文介绍了如何从今天算起减去4个月?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要以"Ymd"
格式声明两个日期:$toDate
和$fromDate
.
I need to declare two dates in "Ymd"
format: $toDate
and $fromDate
.
$toDate
代表今天的日期,$fromDate
必须比今天早4个月.
$toDate
represents today's date and $fromDate
needs to be 4 months earlier than today.
$toDate = Date('Ymd');
$fromDate = ?
如何创建$fromDate
?
推荐答案
使用 strtotime
:
$fromDate = date("Ymd", strtotime("-4 months"));
这篇关于如何从今天算起减去4个月?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!