如何在PHP中设置日期和月份 [英] How to set days and month in PHP

查看:119
本文介绍了如何在PHP中设置日期和月份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我需要帮助和建议来构建算法以获取PHP中的设置日期。



情况是这样的。



如果Ronney选择第1天<15,那么活动日期是(1 / nxt月/ 2016)

如果Ronney选择15天> 31,那么活动日期是(15 /下个月/ 2016)



我尝试过:



Hi,

I need help and suggestion to built algorithm to get set date in PHP.

the situation is like this.

If Ronney select days 1<15 then the active date is (1/nxt month/2016)
if Ronney select days 15>31 then the active date is (15/next month/2016)

What I have tried:

$date = date('Y-m-d');
$date = date('Y-m-d', strtotime('+1 month', strtotime($date)))





但我想设置



But i want set

day

也..

推荐答案

date = date(' Ym-d' );
date = date('Y-m-d');


date = date(' Ym-d',strtotime(' + 1个月',strtotime(
date = date('Y-m-d', strtotime('+1 month', strtotime(


date)))





但是我想要设置



But i want set

day

也..


这篇关于如何在PHP中设置日期和月份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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