0

I have a form that allows a user to enter the length of an event using 2 jquery date pickers which are then stored in a database using date.

I then return the number of days the event lasts for but I need to exclude weekends.

For example if an event lasts from Mon - Mon the result returned would be 6.

Here is how I'm currently returning the number of days from 2 date ranges:

<?=(($currentCourseDates)?ceil((strtotime($currentCourseDates[0]['enddate']." 00:00:00") - strtotime($currentCourseDates[0]['startdate']." 00:00:00")) / 86400)+1:0)?>
Ben Gordon
  • 437
  • 3
  • 10
  • 23
  • Possible duplicate of http://stackoverflow.com/questions/279296/adding-days-to-a-date-but-excluding-weekends?rq=1 – Fluffeh Aug 23 '12 at 11:04

1 Answers1

1

There are plenty of solutions here: Calculate business days for php, using arrays, recursion, numbering

Community
  • 1
  • 1
RossC
  • 1,200
  • 2
  • 11
  • 24