I am trying to create a calendar which enables a user to book certain times over a period of six weeks.
Is there an easy way in php to do this – at present I am using a number of loops with the following:
$end_of_month=cal_days_in_month(CAL_GREGORIAN, $this_month, $this_year);
this seems clumsy and requires numerous loops to determine changes in month, year etc.
So far I am stumped as to what other method to use as I am sure there is a simple way of doing this.
Use
DateTimeobjects, using theDateTime::add()in combination withDateIntervalobjects:This example would output all the dates in a six-week period from the initial date. But it’s very flexible and can do whatever you want it to.