title: Salary PHP Script
body: <p>I'm looking a script that will only show salary dates that do not fall weekend.</p>
  
  <p>For example 1st, 15th and last day of the month can be salary dates but if the date falls on a weekend, the next working day will be displayed.</p>
  
  <p>This is what's been done so far...</p>
  
  <pre><code>&lt;?php
  date_default_timezone_set('UTC');
  
  function firstDayOftheMonth($month){
      return date('j',mktime(1,1,1,$month,1,date('Y')));
  }
  
  function lastDayOfTheMonth($month){
      return date('j',mktime(-1,-1,-1,$month+1,1,date('Y')));
  }
  
  function daysInMonth($month){
      return cal_days_in_month($calendar, $month, date('Y'));
  }
  
  function getDay($day, $month){
      return date('l', mktime(0, 0, 0, $month, $day, date('Y')));
  }
  
  // Set year and month variables.
  $months = 12;
  
  echo "&lt;strong&gt;Month Name, 1st Expenses Day, 2nd Expenses Day, Salary Day&lt;/strong&gt;&lt;br /&gt;";
  
  // Loop through months
  for($month=1; $month &lt;= $months; $month++){
      echo "&lt;strong&gt;" . date('F', mktime(1, 1, 1, $month, 1, date('Y'))) . "&lt;/strong&gt;&lt;br /&gt;";
      // Get No# days for each month of the year.
      $days = daysInMonth($month);
      // Loop through all days of the month.
      for($d=1; $d &lt;= $days; $d++){
          // Get textual days
          $day = getDay($d, $month);
          if($d==firstDayOftheMonth($month) || $d==lastDayOfTheMonth($month) || $d==15){
              echo $d . ", " . $day . ", " . date('Y') . "&lt;br /&gt;";
          }
      }
  
       echo "&lt;hr /&gt;";
  }
  
  ?&gt;
  </code></pre>
  
  <p>Any help is much appreciated.</p>
  
  <p>Thanks in advanced.</p>