Aswin Lutchanah

Hybrid Social Media Manager

How to show the the week date range in for any month ?
Like: 3november-9november ,10nov-16nov so on…

Following a question of Rajiv Kumar on Facebook, I’ve developed a first version of the php function below to get the first and last day of each week of a month. There are four parameters:

  1. $iYear is the variable for the year
  2. $iMonth is the numerical representation of the month (1 – 12)
  3. $sFirstDayOfWeek takes either Monday or Sunday as the first day of the week; default is Monday.
  4. $bExclusive is a boolean which when true takes only weeks within the chosen month but when false, it allows overlapping to take into account all weeks that are related to the chosen month.

DEMO (more…)

Posted In: PHP, Web Development

Tags: , , ,

Leave a Comment