一年一个月? [英] Month by week of the year?
本文介绍了一年一个月?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正试图通过一年中的一个星期的数量来获得一年中的月份数。
所以例如第一周在一月份,返回1,第六周是在二月,所以我想要2。
I'm trying to get the number of the month of the year by the number of a week of the year and the year. So for example week 1 is in january and returns 1, week 6 is in february so I want 2.
我试图去与$ code> date_parse_from_format('W / Y')但没有成功(这是给我错误)。
I tried to go with date_parse_from_format('W/Y')
but had no success (it's giving me errors).
有没有办法去
推荐答案
print date("m",strtotime("2011-W6-1"));
(注意到2011年,1月份有6周,所以第6周(通过某些定义)在月1)。
(noting that in 2011, January has six weeks so week 6 (by some definitions) is in month 1).
这篇关于一年一个月?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文