当前位置: 首页>>代码示例>>PHP>>正文


PHP GregorianToJD函数代码示例

本文整理汇总了PHP中GregorianToJD函数的典型用法代码示例。如果您正苦于以下问题:PHP GregorianToJD函数的具体用法?PHP GregorianToJD怎么用?PHP GregorianToJD使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GregorianToJD函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: GetData

function GetData($val)
{
    $jd = GregorianToJD(1, 1, 1970);
    $gregorian = JDToGregorian($jd + intval($val) - 25569);
    return $gregorian;
    /**显示格式为 “月/日/年” */
}
开发者ID:ucev,项目名称:PHPExcel,代码行数:7,代码来源:readExcel.php

示例2: getday

 public function getday($date = null)
 {
     $date22 = explode(" ", $date);
     $tgl1 = $date22[0];
     // 1 Oktober 2010
     $tgl2 = date("Y-m-d");
     // 24 Oktober 2010
     $pecah1 = explode("-", $tgl1);
     $date1 = $pecah1[2];
     $month1 = $pecah1[1];
     $year1 = $pecah1[0];
     $pecah2 = explode("-", $tgl2);
     $date2 = $pecah2[2];
     $month2 = $pecah2[1];
     $year2 = $pecah2[0];
     $jd1 = GregorianToJD($month1, $date1, $year1);
     $jd2 = GregorianToJD($month2, $date2, $year2);
     // hitung selisih hari kedua tanggal
     $selisih = $jd2 - $jd1;
     //echo $selisih;
     switch ($selisih) {
         case 0:
             return "Hari ini " . $this->getampm($date22[1]);
             break;
         case 1:
             return "Kemarin " . $this->getampm($date22[1]);
             break;
         default:
             $epldate = explode("-", $tgl1);
             return date("F j, Y", mktime(0, 0, 0, $epldate[1], $epldate[2], $epldate[0])) . " " . $this->getampm($date22[1]);
             break;
     }
 }
开发者ID:arjint2004,项目名称:uni912015,代码行数:33,代码来源:comment.php

示例3: nextMonth

 function nextMonth($date)
 {
     $this->JDtoYMD($date, $year, $month, $day);
     if (++$month > 12) {
         $month = 1;
         ++$year;
     }
     return GregorianToJD($month, $day, $year);
 }
开发者ID:rohmad-st,项目名称:fpdf,代码行数:9,代码来源:pdfUSACalendar.php

示例4: GetData

 /**
  * 规范读入的时间,该函数暂时未用到
  * @param unknown $val
  * @return string
  */
 function GetData($val)
 {
     $jd = GregorianToJD(1, 1, 1970);
     $gregorian = JDToGregorian($jd + intval($val) - 25569);
     return $gregorian;
     /**
      * 格林威治时间的转换
      */
 }
开发者ID:sky15179,项目名称:busapp,代码行数:14,代码来源:uploadExcel.php

示例5: insert_pistahan

 public function insert_pistahan($date, $event)
 {
     $jdate = $value;
     $jmonth = date("m", strtotime($value));
     $jday = date('j', strtotime($value));
     $jyear = date('Y', strtotime($value));
     $GregorianToJD = GregorianToJD($jmonth, $jday, $jyear);
     $query = "INSERT INTO `pistahan` (`juliandate`, `event_id`,`jdate`,`jday`,`jmonth`,`jyear`) VALUES (" . $GregorianToJD . "," . $value . "," . $jdate . "," . $jday . "," . $jmonth . "," . $jyear . ")";
     run_mysql_query($query);
     return;
 }
开发者ID:eddiebanz,项目名称:tourism,代码行数:11,代码来源:mga_kalendaryo.php

示例6: excelTime

function excelTime($days, $time = false)
{
    if (is_numeric($days)) {
        //based on 1900-1-1
        $jd = GregorianToJD(1, 1, 1970);
        $gregorian = JDToGregorian($jd + intval($days) - 25569);
        $myDate = explode('/', $gregorian);
        $myDateStr = str_pad($myDate[2], 4, '0', STR_PAD_LEFT) . "-" . str_pad($myDate[0], 2, '0', STR_PAD_LEFT) . "-" . str_pad($myDate[1], 2, '0', STR_PAD_LEFT) . ($time ? " 00:00:00" : '');
        return $myDateStr;
    }
    return $days;
}
开发者ID:xiaoyueer98,项目名称:m-heimiwifi-com,代码行数:12,代码来源:common.php

示例7: DaysBetween

function DaysBetween($date1, $date2)
{
    $date1 = getdate($date1);
    $date2 = getdate($date2);
    $first = GregorianToJD($date1[mon], $date1[mday], $date1[year]);
    $second = GregorianToJD($date2[mon], $date2[mday], $date2[year]);
    if ($first > $second) {
        return $first - $second;
    } else {
        return $second - $first;
    }
}
开发者ID:santara12,项目名称:OpenQuotesAndContracts,代码行数:12,代码来源:CalendarMath.php

示例8: insertToEventTable

function insertToEventTable($eventName, $eventDate, $duration)
{
    $calendar->insert_pistahan($eventDate, $eventName);
    // adjust duration
    $duration -= 1;
    // if duration is already 0, then exit. else call the function again to continue the insert
    if ($duration == 0) {
        return;
    }
    $eventDate = JDToGregorian(GregorianToJD(date("m", strtotime($eventDate)), date('j', strtotime($eventDate)), date('Y', strtotime($eventDate))) - 1);
    insertToEventTable($eventName, $eventDate, $duration);
    return;
}
开发者ID:eddiebanz,项目名称:tourism,代码行数:13,代码来源:kalendaryo_ngayon.php

示例9: get_schedule_by_date

 function get_schedule_by_date($event, $date, $shift)
 {
     $date = explode("-", $date);
     $slot = GregorianToJD($date[1], $date[2], $date[0]) % $this->get_length_schedule($event) + 1;
     $this->db->select(array('user.nickname as nickname'));
     $this->db->where('event', $event);
     $this->db->where('slot', $slot);
     $this->db->where('shift', $shift);
     $this->db->join('user', 'schedule.user=user.kode', 'left');
     $this->db->order_by('user', 'asc');
     $result = $this->db->get($this->tbl_name)->result();
     $data = '';
     foreach ($result as $r) {
         $data .= '<div>' . $r->nickname . '</div>';
     }
     return $data;
 }
开发者ID:adamprasetia,项目名称:mod,代码行数:17,代码来源:Schedule_model.php

示例10: excelTime

function excelTime($date, $time = false)
{
    if (function_exists('GregorianToJD')) {
        if (is_numeric($date)) {
            $jd = GregorianToJD(1, 1, 1970);
            $gregorian = JDToGregorian($jd + intval($date) - 25569);
            $date = explode('/', $gregorian);
            $date_str = str_pad($date[2], 4, '0', STR_PAD_LEFT) . "-" . str_pad($date[0], 2, '0', STR_PAD_LEFT) . "-" . str_pad($date[1], 2, '0', STR_PAD_LEFT) . ($time ? " 00:00:00" : '');
            return $date_str;
        }
    } else {
        $date = $date > 25568 ? $date + 1 : 25569;
        /* There was a bug if Converting date before 1-1-1970 (tstamp 0) */
        $ofs = (70 * 365 + 17 + 2) * 86400;
        $date = date("Y-m-d", $date * 86400 - $ofs) . ($time ? " 00:00:00" : '');
    }
    return $date;
}
开发者ID:ZH9009,项目名称:jjczj,代码行数:18,代码来源:yh_gl_xm_info_dr.php

示例11: selisihTGl

 function selisihTGl($tgl1, $tgl2)
 {
     $pecah1 = explode("-", $tgl1);
     $date1 = $pecah1[2];
     $month1 = $pecah1[1];
     $year1 = $pecah1[0];
     // memecah tanggal untuk mendapatkan bagian tanggal, bulan dan tahun
     // dari tanggal kedua
     $pecah2 = explode("-", $tgl2);
     $date2 = $pecah2[2];
     $month2 = $pecah2[1];
     $year2 = $pecah2[0];
     // menghitung JDN dari masing-masing tanggal
     $jd1 = GregorianToJD($month1, $date1, $year1);
     $jd2 = GregorianToJD($month2, $date2, $year2);
     // hitung selisih hari kedua tanggal
     $selisih = $jd2 - $jd1;
     return $selisih;
 }
开发者ID:ahmadisurahman05,项目名称:AKADEMIK,代码行数:19,代码来源:mylib_helper.php

示例12: selisihHari

 function selisihHari($tglAwal, $tglAkhir)
 {
     // list tanggal merah selain hari minggu
     $tglLibur = array("2013-01-04", "2013-01-05", "2013-01-17");
     // memecah string tanggal awal untuk mendapatkan
     // tanggal, bulan, tahun
     $pecah1 = explode("-", $tglAwal);
     $date1 = $pecah1[2];
     $month1 = $pecah1[1];
     $year1 = $pecah1[0];
     // memecah string tanggal akhir untuk mendapatkan
     // tanggal, bulan, tahun
     $pecah2 = explode("-", $tglAkhir);
     $date2 = $pecah2[2];
     $month2 = $pecah2[1];
     $year2 = $pecah2[0];
     // mencari total selisih hari dari tanggal awal dan akhir
     $jd1 = GregorianToJD($month1, $date1, $year1);
     $jd2 = GregorianToJD($month2, $date2, $year2);
     $selisih = $jd2 - $jd1;
     // proses menghitung tanggal merah dan hari minggu
     // di antara tanggal awal dan akhir
     $libur1 = 0;
     $libur2 = 0;
     for ($i = 1; $i <= $selisih; $i++) {
         // menentukan tanggal pada hari ke-i dari tanggal awal
         $tanggal = mktime(0, 0, 0, $month1, $date1 + $i, $year1);
         $tglstr = date("Y-m-d", $tanggal);
         // menghitung jumlah tanggal pada hari ke-i
         // yang masuk dalam daftar tanggal merah selain minggu
         if (in_array($tglstr, $tglLibur)) {
             $libur1++;
         }
         // menghitung jumlah tanggal pada hari ke-i
         // yang merupakan hari minggu
         if (date("N", $tanggal) == 7) {
             $libur2++;
         }
     }
     // menghitung selisih hari yang bukan tanggal merah dan hari minggu
     return $selisih - $libur1 - $libur2;
 }
开发者ID:AlvaCorp,项目名称:ehrd,代码行数:42,代码来源:Hari.php

示例13: selisihHari

	function selisihHari($tglAwal, $tglAkhir)
	{
	$tglLibur = Array("2015-08-05", "2013-01-05", "2013-01-17");
	$tahun=date('Y');
	$bulanini=date('m');
	$libur1=mysql_query("select * from hari_libur where BULAN='$bulanini' and YEAR(TANGGAL)='$tahun'");
	while($viewdata=mysql_fetch_object($libur1)){
	$harilibur1=array();
	$harilibur1=explode(",",$viewdata->TANGGAL);
		foreach($harilibur1 as $datalibur1){
		} 
	}
	$jumlahlibur1=count($harilibur1);
    $pecah1 = explode("-", $tglAwal);
    $date1 = $pecah1[2];
    $month1 = $pecah1[1];
    $year1 = $pecah1[0];
	$pecah2 = explode("-", $tglAkhir);
    $date2 = $pecah2[2];
    $month2 = $pecah2[1];
    $year2 =  $pecah2[0];
	$jd1 = GregorianToJD($month1, $date1, $year1);
    $jd2 = GregorianToJD($month2, $date2, $year2);

    $selisih = $jd2 - $jd1;
	for($i=1; $i<=$selisih; $i++)
    {
        
        $tanggal = mktime(0, 0, 0, $month1, $date1+$i, $year1);
        $tglstr = date("Y-m-d", $tanggal);
		if (in_array($tglstr, $tglLibur))
        {
           $libur1++;
        }
		if ((date("N", $tanggal) == 7))
        {
           $libur2++;
        }
    }
    return $selisih-$jumlahlibur1-$libur2;
}
开发者ID:smilescripts,项目名称:pegawai,代码行数:41,代码来源:hanyacetak.php

示例14: jvdate

 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;
     }
 }
开发者ID:anugrahbsoe,项目名称:Becak-HMVC-Framework,代码行数:38,代码来源:java_calendar_library.php

示例15: selisihHari

function selisihHari($tglAwal, $tglAkhir)
{
    // list tanggal merah selain hari minggu
    // memecah string tanggal awal untuk mendapatkan
    // tanggal, bulan, tahun
    $pecah1 = explode("-", $tglAwal);
    $date1 = $pecah1[2];
    $month1 = $pecah1[1];
    $year1 = $pecah1[0];
    // memecah string tanggal akhir untuk mendapatkan
    // tanggal, bulan, tahun
    $pecah2 = explode("-", $tglAkhir);
    $date2 = $pecah2[2];
    $month2 = $pecah2[1];
    $year2 = $pecah2[0];
    //exit("error:".$tglAwal."___".$tglAkhir);
    // mencari selisih hari dari tanggal awal dan akhir
    $jd1 = GregorianToJD($month1, $date1, $year1);
    $jd2 = GregorianToJD($month2, $date2, $year2);
    $selisih = $jd2 - $jd1;
    // menghitung selisih hari yang bukan tanggal merah dan hari minggu
    return $selisih;
}
开发者ID:halimc17,项目名称:magsys,代码行数:23,代码来源:sdm_slave_daftartenagakerja.php


注:本文中的GregorianToJD函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。