You are here

function cmfcCalendarV1Julian::monthTotalDays in Calendar Systems 8.2

Same name and namespace in other branches
  1. 8 calendar/v1/calendarSystems/julian.class.inc.php \cmfcCalendarV1Julian::monthTotalDays()
  2. 7 calendar/v1/calendarSystems/julian.class.inc.php \cmfcCalendarV1Julian::monthTotalDays()
  3. 7.2 calendar/v1/calendarSystems/julian.class.inc.php \cmfcCalendarV1Julian::monthTotalDays()

@author Find Number Of Days In This Month

1 call to cmfcCalendarV1Julian::monthTotalDays()
cmfcCalendarV1Julian::date in calendar/v1/calendarSystems/julian.class.inc.php
Implementation of PHP date function This is the simplified versino by Sina Salek

File

calendar/v1/calendarSystems/julian.class.inc.php, line 647

Class

cmfcCalendarV1Julian

Code

function monthTotalDays($month, $day, $year) {
  $jday2 = "";
  $jdate2 = "";
  $lastdayen = $this
    ->phpDate("d", parent::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;
}