获取当前月份和当前年份直到今天的天数 [英] Get the number of days till today for the current month and current year

查看:96
本文介绍了获取当前月份和当前年份直到今天的天数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取当前月份已经过去的天数和当前年份已经过去的天数,例如今天是4月6日。
我应该得到当前月份的6天和
我应该在本年度获得97

How To get the number of days that have already passed from the current month and the number of days that have already passed from the current year eg if today is April 6. I should be getting 6 for current month and I should be getting 97 for current year

有没有办法让我得到除周日以外的其他东西

Is there a way I can get the same excluding SUNDAYS

推荐答案

看看php date() 函数。在您的情况97中,它具有参数'z',这是一年中的一天:

Take a look at the php date() function. It has a parameter 'z', which is the day of the year, in your situation 97:

echo date('z');

与每月的同一天:

echo date('j');

这篇关于获取当前月份和当前年份直到今天的天数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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