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


PHP JDToGregorian函数代码示例

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


在下文中一共展示了JDToGregorian函数的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: JDtoYMD

 function JDtoYMD($date, &$year, &$month, &$day)
 {
     $string = JDToGregorian($date);
     $month = strtok($string, " -/");
     $day = strtok(" -/");
     $year = strtok(" -/");
 }
开发者ID:rohmad-st,项目名称:fpdf,代码行数:7,代码来源:pdfUSACalendar.php

示例3: 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

示例4: 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

示例5: 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

示例6: gawa_ng_kalendaryo

 public function gawa_ng_kalendaryo($year)
 {
     $numberOfDays = 390;
     $newdayofweek = 1;
     $weekNumber = 1;
     $days = "+0 days";
     // check table for the last date on the the table
     $query = "SELECT juliandate FROM fiscalcalendar ORDER BY juliandate desc Limit 1";
     $result = fetch_record($query);
     if ($result['juliandate'] == 0) {
         $juliandate = gregoriantojd(01, 01, date('Y', strtotime($year)));
     } else {
         $juliandate = $result['juliandate'] + 1;
     }
     // $juliandate = gregoriantojd(01,01,date('Y',strtotime($days)));
     echo "<table border='5px'><thead><td>Julian Date</td><td>Gregorian Date</td><td>end of week</td><td>end of month</td><td>week#</td></thead><tbody>";
     for ($i = 0; $i <= $numberOfDays; $i++) {
         // check for end of week
         $days = JDToGregorian($juliandate);
         if (date('N', strtotime($days)) == 7) {
             $endOfWeek = 'Y';
         } else {
             $endOfWeek = 'N';
         }
         // end of year
         if (date("m", strtotime($days)) == 12 && date("j", strtotime($days)) == date("t", strtotime($days))) {
             $endofyear = 'Y';
         } else {
             $endofyear = 'N';
         }
         // end of month
         if (date("j", strtotime($days)) == date("t", strtotime($days))) {
             $endofmonth = 'Y';
         } else {
             $endofmonth = 'N';
         }
         if (date("j", strtotime($days)) == 1) {
             $weekNumber = 1;
             $newdayofweek = date('N', strtotime($days));
         } else {
             if ($newdayofweek == date('N', strtotime($days))) {
                 $weekNumber += 1;
             }
         }
         echo "<tr>" . $juliandate . '</td><td>' . JDToGregorian($juliandate) . '</td><td>' . $endOfWeek . '</td><td>' . $endofmonth . '</td><td>' . $weekNumber . '</td></tr>';
         $query = "INSERT INTO fiscalcalendar (juliandate,fdate, fmonth, fday, fyear, endOfWeek, endofmonth,  dayOfWeek, weekNumber) VALUES('" . $juliandate . "','" . date("y-m-d", strtotime($days)) . "'," . date("m", strtotime($days)) . "," . date('j', strtotime($days)) . "," . date('Y', strtotime($days)) . ",'" . $endOfWeek . "','" . $endofmonth . "','" . date('N', strtotime($days)) . "'," . $weekNumber . ")";
         $result = run_mysql_query($query);
         $juliandate += 1;
     }
 }
开发者ID:eddiebanz,项目名称:tourism,代码行数:50,代码来源:mga_kalendaryo.php

示例7: 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

示例8: sprintf

 $dateinc = sprintf("%04d/%02d/%02d", $dd[2], $dd[0], $dd[1]);
 // next day date
 //day before
 $gregorian = JDToGregorian($jd - 1);
 // mm/dd/yyyy
 $dd = split("/", $gregorian);
 $datedec = sprintf("%04d/%02d/%02d", $dd[2], $dd[0], $dd[1]);
 // previous day date
 //next two day
 $gregorian = JDToGregorian($jd + 2);
 // mm/dd/yyyy
 $dd = split("/", $gregorian);
 $dateinc2 = sprintf("%04d/%02d/%02d", $dd[2], $dd[0], $dd[1]);
 // next day date
 //next three day
 $gregorian = JDToGregorian($jd + 3);
 // mm/dd/yyyy
 $dd = split("/", $gregorian);
 $dateinc3 = sprintf("%04d/%02d/%02d", $dd[2], $dd[0], $dd[1]);
 // next day date
 //		echo "$datedec, |$date|, $dateinc, $dateinc2, $dateinc3\n";
 $buffer = fgets($f2);
 $j = 0;
 while (substr($buffer, 0, 1) == " " and strlen($buffer) > 6) {
     $out = "";
     //echo " $date-$buffer\n";
     #time_start
     if (strlen(trim(substr($buffer, 1, 4))) == 4) {
         $out .= $date . " " . substr($buffer, 1, 2) . ":" . substr($buffer, 3, 2) . ":00\t";
         $et = substr($buffer, 1, 2) + substr($buffer, 3, 2) / 60;
         $m_start = substr($buffer, 1, 2) * 60 + substr($buffer, 3, 2);
开发者ID:helio-vo,项目名称:helio,代码行数:31,代码来源:hec_load_sgs.php

示例9: setLocalDateAndTime

 public function setLocalDateAndTime($id, $date, $time)
 {
     global $objDatabase, $objLocation;
     if ($time >= 0) {
         $timezone = $objLocation->getLocationPropertyFromId($this->getDsObservationProperty($id, 'locationid'), 'timezone');
         $datearray = sscanf($date, "%4d%2d%2d");
         $dateTimeZone = new DateTimeZone($timezone);
         $date = sprintf("%02d", $datearray[1]) . "/" . sprintf("%02d", $datearray[2]) . "/" . $datearray[0];
         $dateTime = new DateTime($date, $dateTimeZone);
         // Returns the timedifference in seconds
         $timedifference = $dateTimeZone->getOffset($dateTime);
         $timedifference = $timedifference / 3600.0;
         $timestr = sscanf(sprintf("%04d", $time), "%2d%2d");
         $jd = cal_to_jd(CAL_GREGORIAN, $datearray[1], $datearray[2], $datearray[0]);
         $hours = $timestr[0] - (int) $timedifference;
         $timedifferenceminutes = ($timedifference - (int) $timedifference) * 60;
         $minutes = $timestr[1] - $timedifferenceminutes;
         if ($minutes < 0) {
             $hours = $hours - 1;
             $minutes = $minutes + 60;
         }
         if ($minutes > 60) {
             $hours = $hours + 1;
             $minutes = $minutes - 60;
         }
         if ($hours < 0) {
             $hours = $hours + 24;
             $jd = $jd - 1;
         }
         if ($hours >= 24) {
             $hours = $hours - 24;
             $jd = $jd + 1;
         }
         $time = $hours * 100 + $minutes;
         $dte = JDToGregorian($jd);
         sscanf($dte, "%2d/%2d/%4d", $month, $day, $year);
         $date = $year . sprintf("%02d", $month) . sprintf("%02d", $day);
     }
     $objDatabase->execSQL("UPDATE observations SET date = \"" . $date . "\" WHERE id = \"" . $id . "\"");
     $objDatabase->execSQL("UPDATE observations SET time = \"" . $time . "\" WHERE id = \"" . $id . "\"");
 }
开发者ID:Hermannhaf,项目名称:DeepskyLog,代码行数:41,代码来源:observations.php

示例10: print_nice_date

 function print_nice_date($jd)
 {
     // format of Thursday, Septemeber 22nd 2012
     if ($jd == 0) {
         return '';
     }
     $date = explode("/", JDToGregorian($jd));
     $output = jddayofweek($jd, 1) . ", " . jdmonthname($jd, 3) . " {$date[1]}, {$date[2]}";
     return $output;
 }
开发者ID:kemosabhay,项目名称:Lightning,代码行数:10,代码来源:Table.php

示例11: date

    if (date("m", strtotime($days)) == 12 && date("j", strtotime($days)) == date("t", strtotime($days))) {
        $endofyear = 'Y';
    } else {
        $endofyear = 'N';
    }
    // end of month
    if (date("j", strtotime($days)) == date("t", strtotime($days))) {
        $endofmonth = 'Y';
    } else {
        $endofmonth = 'N';
    }
    if (date("j", strtotime($days)) == 1) {
        $weekNumber = 1;
        $newdayofweek = date('N', strtotime($days));
    } else {
        if ($newdayofweek == date('N', strtotime($days))) {
            $weekNumber += 1;
        }
    }
    echo "<tr>";
    echo "<td>" . $juliandate . '</td>';
    echo "<td>" . JDToGregorian($juliandate) . '</td>';
    echo '<td>' . $endOfWeek . '</td>';
    echo '<td>' . $endofmonth . '</td>';
    echo '<td>' . $weekNumber . '</td>';
    echo '</tr>';
    $query = "INSERT INTO fiscalcalendar (\n\t\tjuliandate,\n\t\tfdate, \n\t\tfmonth, \n\t\tfday, \n\t\tfyear, \n\t\tendOfWeek, \n\t\tendofmonth,  \n\t\tdayOfWeek, \n\t\tweekNumber) VALUES('" . $juliandate . "','" . date("y-m-d", strtotime($days)) . "'," . date("m", strtotime($days)) . "," . date('j', strtotime($days)) . "," . date('Y', strtotime($days)) . ",'" . $endOfWeek . "','" . $endofmonth . "','" . date('N', strtotime($days)) . "'," . $weekNumber . ")";
    // echo $query;die;
    $result = run_mysql_query($query);
    $juliandate += 1;
}
开发者ID:eddiebanz,项目名称:tourism,代码行数:31,代码来源:GenerateAnnualCalendar.php

示例12: sprintf

 $dateinc = sprintf("%04d/%02d/%02d", $dd[2], $dd[0], $dd[1]);
 // next day date
 //day before
 $gregorian = JDToGregorian($jd - 1);
 // mm/dd/yyyy
 $dd = split("/", $gregorian);
 $datedec = sprintf("%04d/%02d/%02d", $dd[2], $dd[0], $dd[1]);
 // previous day date
 //next two day
 $gregorian = JDToGregorian($jd + 2);
 // mm/dd/yyyy
 $dd = split("/", $gregorian);
 $dateinc2 = sprintf("%04d/%02d/%02d", $dd[2], $dd[0], $dd[1]);
 // next day date
 //next three day
 $gregorian = JDToGregorian($jd + 2);
 // mm/dd/yyyy
 $dd = split("/", $gregorian);
 $dateinc3 = sprintf("%04d/%02d/%02d", $dd[2], $dd[0], $dd[1]);
 // next day date
 if (checkdate($mo, $d, $y)) {
     $date = sprintf("%04d/%02d/%02d", $y, $mo, $d);
 } else {
     $date = "";
 }
 //start time
 if (strlen(trim(substr($buffer, 13, 4))) == 4) {
     $m_start = substr($buffer, 13, 2) * 60 + substr($buffer, 15, 2);
     //start time in minutes
     if (substr($buffer, 13, 2) < 24) {
         $buf[$i++] = $date . " " . substr($buffer, 13, 2) . ":" . substr($buffer, 15, 2) . ":00";
开发者ID:helio-vo,项目名称:helio,代码行数:31,代码来源:hec_load_goes.php

示例13: fromDays

 /**
  * Converts number of days since 24th November, 4714 B.C. (in the proleptic
  * Gregorian calendar, which is year -4713 using 'Astronomical' year
  * numbering) to Gregorian calendar date.
  *
  * Returned date belongs to the proleptic Gregorian calendar, using
  * 'Astronomical' year numbering.
  *
  * The algorithm is valid for all years (positive and negative), and
  * also for years preceding 4714 B.C. (i.e. for negative 'Julian Days'),
  * and so the only limitation is platform-dependent (for 32-bit systems
  * the maximum year would be something like about 1,465,190 A.D.).
  *
  * N.B. Monday, 24th November, 4714 B.C. is Julian Day '0'.
  *
  * Algorithm is from PEAR::Date_Calc
  *
  * @author Monte Ohrt <monte@ispi.net>
  * @author Pierre-Alain Joye <pajoye@php.net>
  * @author Daniel Convissor <danielc@php.net>
  * @author C.A. Woodcock <c01234@netcomuk.co.uk>
  *
  * @param int    $days   the number of days since 24th November, 4714 B.C.
  * @param string $format the string indicating how to format the output
  *
  * @return  Horde_Date  A Horde_Date object representing the date.
  */
 public static function fromDays($days)
 {
     if (function_exists('JDToGregorian')) {
         list($month, $day, $year) = explode('/', JDToGregorian($days));
     } else {
         $days = intval($days);
         $days -= 1721119;
         $century = floor((4 * $days - 1) / 146097);
         $days = floor(4 * $days - 1 - 146097 * $century);
         $day = floor($days / 4);
         $year = floor((4 * $day + 3) / 1461);
         $day = floor(4 * $day + 3 - 1461 * $year);
         $day = floor(($day + 4) / 4);
         $month = floor((5 * $day - 3) / 153);
         $day = floor(5 * $day - 3 - 153 * $month);
         $day = floor(($day + 5) / 5);
         $year = $century * 100 + $year;
         if ($month < 10) {
             $month += 3;
         } else {
             $month -= 9;
             ++$year;
         }
     }
     return new Horde_Date($year, $month, $day);
 }
开发者ID:claudineyqr,项目名称:Kolab-Roundcube-Calendar,代码行数:53,代码来源:Horde_Date.php

示例14: excel_time

 /**
  *@date 2010-7-22
  *@time 上午10:45:39
  */
 function excel_time($days = '40368')
 {
     //function
     if (is_numeric($days)) {
         $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;
     } else {
         return $days;
     }
 }
开发者ID:putera99,项目名称:iic-classified,代码行数:17,代码来源:ExAction.class.php

示例15: excelTime

 function excelTime($date, $time = false)
 {
     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;
     }
     return $date;
 }
开发者ID:tiantuikeji,项目名称:fy,代码行数:11,代码来源:151010100113.PHP


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