计算日历周php

eni*_*cus -8 php date

如果有人知道如何根据php中的给定日期计算日历周,例如06.06.2013(格式如此2013-06-06).是第23周的日历.我整个上午都在寻找解决方案,没有发现任何有用的东西.任何帮助或链接,任何事情都将不胜感激.谢谢

Joh*_*nde 13

使用 date("W")

echo date("W", strtotime('2013-06-06'));
Run Code Online (Sandbox Code Playgroud)

看到它在行动


Eth*_*han 8

date('W')应该给你一年中的一周.RTM

如果您没有将时间作为unix时间戳,则可以strtotime()先使用它并将其作为第二个参数传递

恩. date('W',strtotime($my_time_string))

你可以在这里看到PHP手册

  • +1出于与@MaximKumpan相同的原因 (3认同)