Tore Posted April 30, 2006 Share Posted April 30, 2006 Hi.I would like to be able to find weeknumber and weekdaynumberwithout using the UNIX timestamp (e.g use of mktime).I'm looking for a function that use a date to calculate the above.The reason I'm asking is that I would like to display calendars further back in time that the UNIX timestamp handles.Does anyone out there know if there is a custom function somewhere that are able to calculate which weeknumbera given date is within?would also appreciate something that also find theweekdaynumber for a given date, preferably for both usingmonday and sunday as the first day of the week? Quote Link to comment Share on other sites More sharing options...
KrisNz Posted May 1, 2006 Share Posted May 1, 2006 Haven't used this myself but looks like a good place to start[a href=\"http://au.php.net/calendar\" target=\"_blank\"]Calendar[/a] Quote Link to comment Share on other sites More sharing options...
Barand Posted May 1, 2006 Share Posted May 1, 2006 This could be a usable workaround. If you take my birthday Saturday, Jan 22nd, 1949, and given that the calendar repeats itself exactly every 28 years,[code]<?php $dob = '1949-01-22'; $yr = substr($dob, 0, 4); $tmpyr = $yr + 28; $tmpdob = str_replace($yr, $tmpyr, $dob); echo "Born on a " . date('l', strtotime($tmpdob)) . " in week #" . date('W', strtotime($tmpdob));?>[/code]So basically changing the year from 1949 to 1977 (inside the the 1970 - 2037 unix range).edit: BTW, this works with PHP5 on Windows :-[code]<?php $dob = '1949-01-22'; echo "Born on a " . date('l', strtotime($dob)) . " in week #" . date('W', strtotime($dob));?>[/code] Quote Link to comment 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.