将星期的开始日期从星期一更改为星期日 [英] Changing the start day of week from 'monday' to 'tuesday' in Php

查看:266
本文介绍了将星期的开始日期从星期一更改为星期日的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好朋友,我需要得到周数。



根据当前年份1,2,3 ... 52。

在php周默认从周一或周日开始



有没有设置星期二默认开始日期。 / p>

我的代码是...

  echo今年是..。 $ weekNumber = date(W);对于exapmle 16输出

。正确应该是15。



因为我需要从星期二开始的星期不是星期一,任何人都可以告诉我如何做。



因为有非常少的文件,它将帮助别人在未来如果找到答案:)



您的帮助和时间将不胜感激。或者请在评论中建议我一个方式):

解决方案

我得到了解决方案感谢ramesh的回答。 >

要更改星期二作为一周的开始,我使用了:

  echoWeek count:.date(W,strtotime( -  1 day)); 


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 :)

解决方案

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"));

这篇关于将星期的开始日期从星期一更改为星期日的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆