ahhoi Posted January 2, 2009 Share Posted January 2, 2009 The simple function echo week number ('W') currently (on 2.1.09) results in '01' although it's actually week '53' (2.1.09). Working locally on a Mac with PhP version 5.2.6. Any ideas?? Quote Link to comment https://forums.phpfreaks.com/topic/139209-problem-with-calling-week-number-2009/ Share on other sites More sharing options...
DarkWater Posted January 2, 2009 Share Posted January 2, 2009 There are about 52.18 weeks in a year. I think that January 2nd this year falls after the 53rd week. It could have something to do with your computer's time on the Mac though. I don't know. Is it mission-critical? Quote Link to comment https://forums.phpfreaks.com/topic/139209-problem-with-calling-week-number-2009/#findComment-728115 Share on other sites More sharing options...
ahhoi Posted January 2, 2009 Author Share Posted January 2, 2009 There are about 52.18 weeks in a year. I think that January 2nd this year falls after the 53rd week. It could have something to do with your computer's time on the Mac though. I don't know. Is it mission-critical? According to ISO specification (on which the PHP date functions are based!?) the 2.1.09 is in week 53. Yep, it's very critical as a major script is built upon correct/valid week number function :-// thx Quote Link to comment https://forums.phpfreaks.com/topic/139209-problem-with-calling-week-number-2009/#findComment-728117 Share on other sites More sharing options...
GingerRobot Posted January 2, 2009 Share Posted January 2, 2009 There are about 52.18 weeks in a year. I think that January 2nd this year falls after the 53rd week. It could have something to do with your computer's time on the Mac though. I don't know. Is it mission-critical? According to ISO specification (on which the PHP date functions are based!?) the 2.1.09 is in week 53. Yep, it's very critical as a major script is built upon correct/valid week number function :-// thanks According to wikipedia, this is week 1. There are mutually equivalent descriptions of week 01: * the week with the year's first Thursday in it (the formal ISO definition), * the week with 4 January in it, * the first week with the majority (four or more) of its days in the starting year, and * the week starting with the Monday in the period 29 December – 4 January. If 1 January is on a Monday, Tuesday, Wednesday or Thursday, it is in week 01. If 1 January is on a Friday, Saturday or Sunday, it is in week 52 or 53 of the previous year. 28 December is always in the last week of its year. Quote Link to comment https://forums.phpfreaks.com/topic/139209-problem-with-calling-week-number-2009/#findComment-728119 Share on other sites More sharing options...
DarkWater Posted January 2, 2009 Share Posted January 2, 2009 Actually, the ISO specification says that the first week began on December 29th this year. EDIT: GingerRobot got it too. xD Quote Link to comment https://forums.phpfreaks.com/topic/139209-problem-with-calling-week-number-2009/#findComment-728120 Share on other sites More sharing options...
ahhoi Posted January 2, 2009 Author Share Posted January 2, 2009 ups, my fault - thx for this!! Quote Link to comment https://forums.phpfreaks.com/topic/139209-problem-with-calling-week-number-2009/#findComment-728121 Share on other sites More sharing options...
DarkWater Posted January 2, 2009 Share Posted January 2, 2009 In case anyone else is interested: << < January 2009 > >> Wk Mo Tu We Th Fr Sa Su (1) 29 30 31 1 2 3 4 (2) 5 6 7 8 9 10 11 (3) 12 13 14 15 16 17 18 (4) 19 20 21 22 23 24 25 (5) 26 27 28 29 30 31 1 They had that on the Wiki article, which was actually rather informative. I never bothered learning about week numbering like that. Cool. EDIT: It won't line up for me, but you get the idea. Quote Link to comment https://forums.phpfreaks.com/topic/139209-problem-with-calling-week-number-2009/#findComment-728123 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.