简体   繁体   English

如何找出明年?

[英]How to find out the next year?

Sorry for the title....In PHP I use the date('w',mydate) to get the week and then I got the week of the date.If user clik next week it increments the current week by one. 抱歉,标题....在PHP中,我使用date('w',mydate)获取星期,然后获取日期的星期。如果用户单击下周,它将使当前星期增加一。

For example date('w',2009-12-10 05:00:00) it returns week as 50.if i click next week button iincrement as 51 and display the dates.at the end of 53 eeks also it takes as 54,55,56,etc... But I want to display as 1st week of january 2010.How can I do? 例如date('w',2009-12-10 05:00:00)返回的星期为50.如果我单击下一周的按钮将i递增为51并显示日期。则在53周结束时也将其取为54 ,55,56,etc ...但我想显示为2010年1月的第一周。我该怎么办?

strtotime('+1 week', $timestamp);

It's not very clear from your question what you want to do, but ... 从您的问题中不清楚您想做什么,但是...

Because there are not exactly 52 weeks of 7 days in a year, and because the 'weeknumber' is incremented every Monday (at least in my desk diary) you'll find that the last few days of December are week 53. 因为一年中没有7周的确切 52周,并且因为“ weeknumber”每个星期一都增加(至少在我的办公桌日记中),所以您会发现12月的最后几天是53周。

My desk diary shows Jan 1 as Week 1, and Dec 28..31 as week 53 of 2009. 我的办公桌日记显示1月1日为第1周,12月28..31为2009年的第53周。

Is this the problem? 这是问题吗? Are you unhappy about the week 53? 您对第53周感到不满吗?

If your code is returning weeks 54, 55, 56, something is wrong with it and you should show us the code. 如果您的代码将在第54、55、56周返回,则说明您的代码有问题,请向我们显示代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM