gausie Posted March 11, 2007 Share Posted March 11, 2007 Array ( [0] => 17:28 [1] => 17:40 [2] => 17:52 [3] => 18:04 [4] => 19:16 ) I know that 0 in the array is a value corresponding to the first Friday in this month, 1 to the second Friday etc.. I want to change the key to the UNIX timestamp of the day its referring to. Any help would be graciously appreciated Thanks Gausie Quote Link to comment Share on other sites More sharing options...
per1os Posted March 11, 2007 Share Posted March 11, 2007 PHP.NET look up the function "mktime" --FrosT Quote Link to comment Share on other sites More sharing options...
gausie Posted March 11, 2007 Author Share Posted March 11, 2007 How with mktime could I work out what the date of each Friday in a month was? Gausie Quote Link to comment Share on other sites More sharing options...
Barand Posted March 11, 2007 Share Posted March 11, 2007 try <?php $month = 3; $m1 = mktime(0,0,0,$month,1,date('Y')); // date of 1st of month $dow = date('w', $m1); // day of week $offset = (12 - $dow )%7; // how far away is next friday $f1 = strtotime("+$offset days", $m1); // get 1st friday date while (date('m', $f1) == $month ) { // loop through fridays in month echo date('Y-m-d', $f1), '<br/>'; $f1 = strtotime("+7 days", $f1); } ?> Quote Link to comment Share on other sites More sharing options...
gausie Posted March 11, 2007 Author Share Posted March 11, 2007 Thanks!! Of course, you only need to get the first one, then loop the days! Gausie 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.