You are here

function DatexHejri::monthTotalDays in Datex 7.2

* @author * Find Number Of Days In This Month

File

datex_api/DatexHejri.inc, line 254

Class

DatexHejri
@author Sina Salek

Code

function monthTotalDays($month, $day, $year) {
  $jday2 = "";
  $jdate2 = "";
  $lastdayen = $this
    ->phpDate("d", mktime(0, 0, 0, $month + 1, 0, $year));
  list($jyear, $jmonth, $jday) = $this
    ->fromGregorian($year, $month, $day);
  $lastdatep = $jday;
  $jday = $jday2;
  while ($jday2 != "1") {
    if ($day < $lastdayen) {
      $day++;
      list($jyear, $jmonth, $jday2) = $this
        ->fromGregorian($year, $month, $day);
      if ($jdate2 == "1") {
        break;
      }
      if ($jdate2 != "1") {
        $lastdatep++;
      }
    }
    else {
      $day = 0;
      $month++;
      if ($month == 13) {
        $month = "1";
        $year++;
      }
    }
  }
  return $lastdatep - 1;
}