Changing the start day of week from 'monday' to 'tuesday' in Php

女生的网名这么多〃 提交于 2020-01-11 02:33:21

问题


Hi friends i need to get the week count .

for ex 1,2,3 .... 52 based on the current year .

In php week starts from Monday or Sunday by default

Is there anyway to set 'Tuesday' has default starting day .

my code is ...

echo "current week of 2012 this year is ..". $weekNumber = date("W");

output for exapmle 16 . whereas correct should be 15 .

because i need the week starting from tuesday not monday , can anyone tell me how to do it .

since there is very less documentation on it will help others in future if answer is found :)

your help and time will be appreciated . or please suggest me a way in comments then :)


回答1:


I got my solution thanks to an answer from ramesh.

To change Tuesday as the start of the week, I did it by using:

echo "Week count : ".date("W", strtotime("- 1 day"));


来源:https://stackoverflow.com/questions/10174745/changing-the-start-day-of-week-from-monday-to-tuesday-in-php

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!