Home >Backend Development >PHP Tutorial > [日期]已知月份,第几周,星期几。怎么获取day的值-请各位大侠指教

[日期]已知月份,第几周,星期几。怎么获取day的值-请各位大侠指教

WBOY
WBOYOriginal
2016-06-13 12:57:32762browse

[日期]已知月份,第几周,星期几。如何获取day的值---请各位大侠指教
如题
例如,已知当前月份,第几周,和星期几。。如果获取这天是几号?


------解决方案--------------------
$年份 = 2013;<br />
$月份 = 1;<br />
$周数 = 2;<br />
$周几 = 2;<br />
<br />
$t = strtotime("$年份-$月份-1");<br />
$dw = $周几 - date('w', $t);<br />
echo date('Y-m-d', strtotime(($周数-1)." week $dw day", $t));
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn