php查找特定日期的周数
我想从特定开始日期查找特定周数。例如,$date 是从数据库中拖动的(即 07/08/2011),
我希望这是开始日期,因此从该日期开始现在是第 3 周。这是我到目前为止的代码,但只显示了 ISO 版本:
$date = strtotime("".$row['start_date']."");
$weekNumber = date("W", $date);
print $weekNumber;
我已经用谷歌搜索了过去两个小时,但似乎找不到任何可以解决这个问题的东西!任何帮助将非常感谢!
I want to find a specific week number from the specific start date. For example $date is dragged from the database (i.e. 07/08/2011)
I want this to be the start date so it would be week 3 now from this date. This is the code i have so far but just shows the ISO version:
$date = strtotime("".$row['start_date']."");
$weekNumber = date("W", $date);
print $weekNumber;
I have googled for past two hours but cannot seem to find any thing that resolves this! any help would be great thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
获取现在与开始日期之间的差值,然后除以 7 天(7*86400 秒)
Get the difference between now and the startdate, and then divide by seven days (7*86400 seconds)
您可以直接从数据库中将周数与主要日期一起拖动。
例如,
You can drag week number from db directly along with main date.
For example,