You are here

private function Date::dayOfWeek in PersianTools 7

returns weekday of the specified day of the year

@access private

Parameters

int $yearValue:

boolean $calendarType:

Return value

mixed

2 calls to Date::dayOfWeek()
Date::format in includes/Date.php
this is a clone of the internal php function date() with a few exceptions in the acceptable parameters
Date::weekOfYear in includes/Date.php
returns the week of the year @access private

File

includes/Date.php, line 296

Class

Date

Namespace

Shamsi

Code

private function dayOfWeek($yearValue, $dayOfYear = 0) {
  $Rasad = $this
    ->calcRasad($yearValue);
  $count2820 = floor($Rasad / 2820);
  $mod2820 = $Rasad % 2820;
  $count128 = floor($mod2820 / 128);
  $mod128 = $mod2820 % 128;
  $leapCount = 0;
  while ($mod128 > $this->_khayamii[$leapCount]) {
    $leapCount++;
  }
  $yearStartDay = ($count2820 + 1) * 3 + $count128 * 5 + $mod128 + $leapCount;
  if ($dayOfYear > 0) {
    $dayOfYear--;
  }
  return ($yearStartDay + $dayOfYear) % 7;
}