如何使用PHP查找下个月的第一天以及到该日期为止的剩余天数 [英] How to find first day of the next month and remaining days till this date with PHP

查看:200
本文介绍了如何使用PHP查找下个月的第一天以及到该日期为止的剩余天数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何才能找到下个月的第一天以及从今天至今的剩余天数?

How can I find first day of the next month and the remaining days till this day from the present day?

谢谢

推荐答案

在下个月的第一天为00:00创建时间戳记:

Create a timestamp for 00:00 on the first day of next month:

$firstDayNextMonth = strtotime('first day of next month');

到该日期为止的天数是从现在到现在的秒数除以(24 * 60 * 60).

The number of days til that date is the number of seconds between now and then divided by (24 * 60 * 60).

$daysTilNextMonth = ($firstDayNextMonth - time()) / (24 * 3600);

这篇关于如何使用PHP查找下个月的第一天以及到该日期为止的剩余天数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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