How to exclude weekend and holidays

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
johnj
php-forum Super User
php-forum Super User
Posts: 1803
Joined: Thu Mar 10, 2011 5:07 pm

Mon Aug 12, 2013 1:18 am

something like this:

Code: Select all


function has_exceeded_30_days($app_date)
{
// do necessary validations
// todays date should be in the same format as that of application date

$diff_in_secs = strtotime($todays_date) - strtotime($app_date);
$diff_in_days = floor($diff_in_secs/3600/24);
if ($diff_in_days > 30)
{
    return TRUE;
}
return FALSE;
}
Usually this function is placed in the Library of CI. A controller call is then placed to this function and if the function returns TRUE then appropriate view is loaded to flash the message.

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 5 guests