You are here

private function Date::_date in PersianTools 7

sets the full date data Y;M;D;H;I;S in various class attributes

@access private

Return value

void

2 calls to Date::_date()
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::__construct in includes/Date.php
returns the week of the year

File

includes/Date.php, line 411

Class

Date

Namespace

Shamsi

Code

private function _date() {
  $this
    ->_zone();
  $timeStamp = $this->_timestamp;
  $timeStamp = $timeStamp + $this->_timezoneOffset;
  $Seconds = floor($timeStamp % 60);
  $Minutes = floor($timeStamp % 3600 / 60);
  $Hours = floor($timeStamp % 86400 / 3600);
  $Days = floor($timeStamp / 86400);
  $Days += 287;
  $Years = floor($Days / self::KHAYAM_YEAR - $Days * self::KHAYAM_YEAR_CORRECTION);
  $dayOfYear = $Days - round($Years * self::KHAYAM_YEAR, 0);
  if ($dayOfYear == 0) {
    $dayOfYear = 366;
  }
  $Years += 1348;
  $Months = 0;
  while ($Months < 12 && $dayOfYear > $this->_mountCounter[$Months]) {
    $Months++;
  }
  $Days = $dayOfYear - $this->_mountCounter[$Months - 1];
  $this->_second = $Seconds;
  $this->_minute = $Minutes;
  $this->_hour = $Hours;
  $this->_day = $Days;
  $this->_month = $Months;
  $this->_year = $Years;
  $this->_dayOfYear = $dayOfYear;
}