I am trying to make a function that would return all given days of a given month or a year. For instance I wanted to get all Mondays in a given month/year OR I wanted to get all Saturdays for a given month / year...
Function would be something like:
PHP Code:
function getDaysOfMonth($month, $year, $day_of_week) {
// $month = 1 - 12
// $year = 2010, etc
// $day_of_week = 1,2,3, etc (1 for Monday, 2 for Tuesday, 7 for Sunday)
......
}
Im puzzled by a "good way" to do this. If possible I only want the loop within the function to execute 5 times (as there would be most 5 "Mondays or Tuesdays, etc" in a given week. I can do this if I loop though the entire month but dont want it looping 30+ times... Hope someone can help,
Adam
I am trying to make a function that would return all given days of a given month or a year. For instance I wanted to get all Mondays in a given month/year OR I wanted to get all Saturdays for a given month / year...
Function would be something like:
PHP Code:
function getDaysOfMonth($month, $year, $day_of_week) {
// $month = 1 - 12
// $year = 2010, etc
// $day_of_week = 1,2,3, etc (1 for Monday, 2 for Tuesday, 7 for Sunday)
......
}
Im puzzled by a "good way" to do this. If possible I only want the loop within the function to execute 5 times (as there would be most 5 "Mondays or Tuesdays, etc" in a given week. I can do this if I loop though the entire month but dont want it looping 30+ times... Hope someone can help,
Adam
|
|
Search Webmaster Help and Solution
Getting every given day of a monthRelated ItemsQuery failed: connection to localhost:3354 failed (errno=111, msg=Connection refused). |
