private function jvdate($day, $month, $year)
 {
     $julian = GregorianToJD($month, $day, $year);
     if ($julian >= 1937808 && $julian <= 536838867) {
         $date = cal_from_jd($julian, CAL_GREGORIAN);
         $d = $date['day'];
         $m = $date['month'] - 1;
         $y = $date['year'];
         $mPart = ($m - 13) / 12;
         $jd = $this->intPart(1461 * ($y + 4800 + $this->intPart($mPart)) / 4) + $this->intPart(367 * ($m - 1 - 12 * $this->intPart($mPart)) / 12) - $this->intPart(3 * $this->intPart(($y + 4900 + $this->intPart($mPart)) / 100) / 4) + $d - 32075;
         $l = $jd - 1948440 + 10632;
         $n = $this->intPart(($l - 1) / 10631);
         $l = $l - 10631 * $n + 354;
         $j = $this->intPart((10985 - $l) / 5316) * $this->intPart(50 * $l / 17719) + $this->intPart($l / 5670) * $this->intPart(43 * $l / 15238);
         $l = $l - $this->intPart((30 - $j) / 15) * $this->intPart(17719 * $j / 50) - $this->intPart($j / 16) * $this->intPart(15238 * $j / 43) + 29;
         $m = $this->intPart(24 * $l / 709);
         $d = $l - $this->intPart(709 * $m / 24);
         $y = 30 * $n + $j - 30;
         $yj = $y;
         //+512; Tahun jawa Tahun Hijriyah + 512
         $h = ($julian + 3) % 5;
         $i = $yj;
         if ($i >= 8) {
             while ($i > 7) {
                 $i = $i - 8;
                 $yn = $i;
             }
         } else {
             $yn = $i;
         }
         if ($julian <= 1948439) {
             $y--;
         }
         return array('dday' => $date['dow'], 'javaDay' => $d, 'javaMonth' => $m, 'javaYear' => $yj, 'javaDday' => $h, 'yearName' => $yn);
     } else {
         return false;
     }
 }
Ejemplo n.º 2
0
    //SEGMENT 1.0
    $arSeg1 = array("Ianuarius", "Februarius", "Martius", "Aprilis", "Maius", "Iunius", "Iulius", "Augustus", "October", "Messidor", "November", "December");
    //SEGMENT 2.0
    $arSeg2 = array("Ianuariis", "Februariis", "Martiis", "Aprilibus", "Maiis", "Iuniis", "Iuliis", "Augustis", "Septembribus", "Octobribus", "Novembribus", "Decembribus");
    //SEGMENT 3.0
    $arSeg3 = array("Ianuarias", "Februarias", "Martias", "Apriles", "Maias", "Iunias", "Iulias", "Augustas", "Septembres", "Octobres", "Novembres", "Decembres");
    /*
    	   if ((date('L'))==1){ 
    	   		return $arSeg3[(date('n')-1];
    	   } else {
    	if (rand(1,2) == 1) {
    		return $arSeg2[(date('n'))-1];
    	} else {
    		return $arSeg1[(date('n'))-1];
    	}
    	   }
    */
}
function GetLatinDate($timeseed)
{
    return decrom(date('yyyy')) . ' of year ' . LatinMonthNames($timeseed) . ' in day ' . decrom(date('t'));
}
//$arDateFrench = gregorian2FrenchDateArray(date('d',$tme), date('m',$tme), date('Y',$tme)) ;
$gregorianMonth = date(n, $tme);
$gregorianDay = date(j, $tme);
$gregorianYear = date(Y, $tme);
$arDateFrench = cal_from_jd(gregoriantojd($gregorianMonth, $gregorianDay, $gregorianYear), CAL_FRENCH);
$jdDate = gregoriantojd($gregorianMonth, $gregorianDay, $gregorianYear);
$hebrewMonthName = jdmonthname($jdDate, 4);
$hebrewDate = jdtojewish($jdDate);
list($hebrewMonth, $hebrewDay, $hebrewYear) = split('/', $hebrewDate);
<?php

$x = 882858030;
var_dump(cal_from_jd($x, CAL_GREGORIAN));
Ejemplo n.º 4
0
 function getCalender($week_start = 0)
 {
     $c_str = "";
     $day = 1;
     // カレンダーの情報を設定する
     if ($this->cal == CAL_GREGORIAN) {
         $time = mktime(0, 0, 0, $this->month, $day, $this->year);
         $date = date('Y/m/d', $time);
         $week = date('w', $time);
         $month_end = date('t', $time);
     } else {
         if ($this->cal == CAL_JULIAN) {
             $time = cal_to_jd(CAL_GREGORIAN, $this->month, $this->day, $this->year);
             $date = cal_from_jd($time, CAL_GREGORIAN);
             $date = $date['year'] . '/' . sprintf('%02d', $date['month']) . '/' . sprintf('%02d', $date['day']);
             $week = jddayofweek(cal_to_jd(CAL_GREGORIAN, $this->month, $day, $this->year), 0);
             $month_end = cal_days_in_month(CAL_GREGORIAN, $this->month, $this->year);
         } else {
             return NULL;
         }
     }
     // カレンダーを作成
     $c_str .= '<table class="calenar_table" cellpadding="0" cellspacing="1" summary="カレンダー">' . "\n";
     $c_str .= '<thead><tr>' . "\n";
     foreach ($this->week_str as $key => $val) {
         $c_str .= '<th class="' . $val['week'] . '" abbr="' . $val['abbr'] . '">' . $val['date'] . '</th>' . "\n";
     }
     // 曜日を作成
     $c_str .= '</tr></thead>' . "\n";
     // 日付を設定
     $c_str .= '<tbody>' . "\n";
     $c_str .= '<tr>' . "\n";
     if ($week > 0) {
         $c_str .= '<td class="' . $this->week_str[$week]['week'] . '" colspan="' . $week . '">&nbsp;</td>' . "\n";
     }
     for ($day = 1; $day <= $month_end; $day++, $week++) {
         if ($week >= 7) {
             $week = $week % 7;
             $c_str .= '</tr>' . "\n" . '<tr>' . "\n";
         }
         $text = $day;
         if (isset($this->days[$day])) {
             $text = $this->_replaseDay($this->year, $this->month, $day, $this->days[$day]);
         }
         $class = $this->week_str[$week]['week'];
         if ($this->day == $day) {
             $class .= " today";
         }
         $colspan = '';
         if ($day == $month_end) {
             $colspan = ' colspan="' . (7 - $week) . '"';
         }
         $c_str .= '<td class="' . $class . '"' . $colspan . '>' . $text . '</td>' . "\n";
     }
     $c_str .= '</tr>' . "\n";
     $c_str .= '</tbody>' . "\n";
     // リンクを設定
     $c_str .= '<tfoot>' . "\n";
     $c_str .= '<td class="foot_left" colspan="1">' . $prev . '</td>' . "\n";
     $c_str .= '<td class="foot_center" colspan="5">' . $date . '</td>' . "\n";
     $c_str .= '<td class="foot_left" colspan="1">' . $next . '</td>' . "\n";
     $c_str .= '</tfoot>' . "\n";
     $c_str .= '</table>' . "\n";
     return $c_str;
 }
Ejemplo n.º 5
0
<?php

//返回某一个历法中  某年  某月的总天数   CAL_GREGORIAN,CAL_JULIAN,CAL_JEWISH 和CAL_FRENCH。
$num = cal_days_in_month(CAL_GREGORIAN, 8, 2003);
// 31
echo "There was {$num} days in August 2003";
echo "<br/>";
echo "<pre>";
//cal_from_jd ( int $jd , int $calendar )
$today = unixtojd(mktime(0, 0, 0, 8, 16, 2003));
print_r(cal_from_jd($today, CAL_GREGORIAN));
echo "<br/>";
echo "<pre>";
$info = cal_info(0);
print_r($info);
//指定年份的复活节 午夜时分的时间戳
echo "<br/>";
echo date("M-d-Y", easter_date(1999));
echo "<br/>";
echo easter_days(2016);
echo "<br/>";
$date = new DateTime('2000-01-01');
$date->add(new DateInterval('P10D'));
echo $date->format('Y-m-d') . "\n";
//2000-01-11
echo "<br/>";
$date = DateTime::createFromFormat('j-M-Y', '15-Feb-2009');
echo $date->format('Y-m-d');
echo "<br/>";
$date = new DateTime('2016-12-12');
$date->modify('+1 day');
Ejemplo n.º 6
0
function format_greg_date_for_erev($hmonth, $hday, $hyear)
{
    $jd = jewishtojd($hmonth, $hday, $hyear);
    $greg_cal = cal_from_jd($jd, CAL_GREGORIAN);
    return sprintf("%s, %s %s %s", $greg_cal["abbrevdayname"], $greg_cal["day"], $greg_cal["monthname"], $greg_cal["year"]);
}
Ejemplo n.º 7
0
<?php

$x = 882858043;
var_dump(cal_from_jd($x, CAL_JULIAN));
Ejemplo n.º 8
0
 /**
  * Method to get the holidays off all year
  * 
  * @param int $unixtime the date to check.
  * @param type $walledCity
  * @param type $isAbroad used to calculate Hag Sheni. Not implemented yet
  * 
  * @return string
  */
 public static function getHolidaysForYear($unixtime, $walledCity = false, $isAbroad = false)
 {
     $retArr = self::$STANDARD_YEAR_HEBCAL_HOLIDAYS;
     list($month, $day, $year) = self::getHebrewDate($unixtime, true);
     $isLeapYear = self::isLeapYear($unixtime);
     if ($isLeapYear) {
         //TODO add leap year data
         // handle purim month
         $retArr['07/13'] = $retArr['06/13'];
         //Purim evening
         $retArr['07/14'] = $retArr['06/14'];
         //Purim is in AdarII
         unset($retArr['06/13']);
         unset($retArr['06/14']);
     }
     //handled short Kislev
     if (cal_days_in_month(CAL_JEWISH, 3, (int) $year) == 29) {
         $retArr['04/03'] = $retArr['04/02'];
         //Hanukka
     }
     //Purim when you have a wall around you
     if ($walledCity) {
         $retArr['06/15'] = $retArr['06/14'];
         $retArr['06/14'] = $retArr['06/13'];
         unset($retArr['06/13']);
     }
     if (cal_from_jd(jewishtojd(8, 27, $year), CAL_JEWISH)['dow'] == 5) {
         // prepone Yom HaShoah
         $retArr['08/25'] = $retArr['08/26'];
         $retArr['08/26'] = $retArr['08/27'];
         unset($retArr['08/27']);
     } else {
         if (cal_from_jd(jewishtojd(8, 27, $year), CAL_JEWISH)['dow'] == 0) {
             // postpone
             $retArr['08/28'] = $retArr['08/27'];
             $retArr['08/27'] = $retArr['08/26'];
             unset($retArr['08/26']);
         }
     }
     if (cal_from_jd(jewishtojd(9, 5, $year), CAL_JEWISH)['dow'] == 1) {
         // postpone Yom Hazikaron & Atzma'ut from Monday
         $retArr['09/06'] = $retArr['09/05'];
         $retArr['09/05'] = $retArr['09/04'];
         $retArr['09/04'] = $retArr['09/03'];
         unset($retArr['09/03']);
     } else {
         if (cal_from_jd(jewishtojd(9, 5, $year), CAL_JEWISH)['dow'] == 6) {
             // prepone from Saturday
             $retArr['09/01'] = $retArr['09/03'];
             $retArr['09/02'] = $retArr['09/04'];
             $retArr['09/03'] = $retArr['09/05'];
             unset($retArr['09/04']);
             unset($retArr['09/05']);
         } else {
             if (cal_from_jd(jewishtojd(9, 5, $year), CAL_JEWISH)['dow'] == 5) {
                 // prepone from Friday
                 $retArr['09/02'] = $retArr['09/03'];
                 $retArr['09/03'] = $retArr['09/04'];
                 $retArr['09/04'] = $retArr['09/05'];
                 unset($retArr['09/05']);
             }
         }
     }
     if (cal_from_jd(jewishtojd(9, 28, $year), CAL_JEWISH)['dow'] == 5) {
         // prepone Jerusalem day
         $retArr['08/27'] = $retArr['08/28'];
         unset($retArr['08/28']);
     }
     return $retArr;
 }
Ejemplo n.º 9
0
 /**
  * 获得用户笔记的月分布情况
  * @param  $uid
  */
 public function getNoteProfileOfMonth($uid, $year, $month)
 {
     $calMonth = array();
     $daysInMonth = cal_days_in_month(CAL_GREGORIAN, $month, $year);
     $inday = 1;
     for ($ws = 0; $ws < 6; $ws++) {
         $calWeek = array();
         for ($date = 0; $date < 7; $date++) {
             $jd = unixtojd(mktime(0, 0, 0, $month, $inday, $year));
             $calDay = cal_from_jd($jd, CAL_GREGORIAN);
             if ($calDay['dow'] == $date & $inday <= $daysInMonth) {
                 $daily = array();
                 $daily['date'] = $inday;
                 $daily['note_num'] = $this->getUserDailyNotesNumb($uid, $month, $inday, $year);
                 array_push($calWeek, $daily);
                 $inday++;
             } else {
                 array_push($calWeek, 0);
             }
         }
         array_push($calMonth, $calWeek);
     }
     return $calMonth;
 }
Ejemplo n.º 10
0
<?php

// 13 Floréal XI
// $jd is 2379714, the Julian day count
$jd = cal_to_jd(CAL_FRENCH, 8, 13, 11);
$french = cal_from_jd($jd, CAL_FRENCH);
/* $french is array('date' => '8/13/11',
                    'month' => 8,
                    'day' => 13,
                    'year' => 11,
                    'dow' => 2,
                    'abbrevdayname' => 'Tue',
                    'dayname' => 'Tuesday',
                    'abbrevmonth' => 'Floreal',
                    'monthname' => 'Floreal'));
*/
// May 3, 1803 - sale of Louisiana to the US
$gregorian = cal_from_jd($jd, CAL_GREGORIAN);
/* $gregorian is array('date' => '5/3/1803',
                       'month' => 5,
                       'day' => 3,
                       'year' => 1803,
                       'dow' => 2,
                       'abbrevdayname' => 'Tue',
                       'dayname' => 'Tuesday',
                       'abbrevmonth' => 'May',
                       'monthname' => 'May'));
*/
Ejemplo n.º 11
0
<?php

print_r(cal_from_jd(1748326, CAL_GREGORIAN));
print_r(cal_from_jd(1748324, CAL_JULIAN));
print_r(cal_from_jd(374867, CAL_JEWISH));
print_r(cal_from_jd(0, CAL_FRENCH));