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


PHP gregoriantojd函数代码示例

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


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

示例1: compararFechas

function compararFechas($primera, $segunda) {
    $valoresPrimera = explode("/", $primera);
    $valoresSegunda = explode("/", $segunda);

    $diaPrimera = $valoresPrimera[0];
    $mesPrimera = $valoresPrimera[1];
    $anyoPrimera = $valoresPrimera[2];

    $diaSegunda = $valoresSegunda[0];
    $mesSegunda = $valoresSegunda[1];
    $anyoSegunda = $valoresSegunda[2];

    $diasPrimeraJuliano = gregoriantojd($mesPrimera, $diaPrimera, $anyoPrimera);
    $diasSegundaJuliano = gregoriantojd($mesSegunda, $diaSegunda, $anyoSegunda);

    if (!checkdate($mesPrimera, $diaPrimera, $anyoPrimera)) {
        // "La fecha ".$primera." no es válida";
        return 0;
    } elseif (!checkdate($mesSegunda, $diaSegunda, $anyoSegunda)) {
        // "La fecha ".$segunda." no es válida";
        return 0;
    } else {
        return $diasPrimeraJuliano - $diasSegundaJuliano;
    }
}
开发者ID:suavid,项目名称:terceros,代码行数:25,代码来源:alias.php

示例2: id_to_code

/**
 * Takes the payment data gotten from process_pdt_function.php's function
 * checks the transaction details and gives a code based on several things:
 * [receiver_email] => the seller's email
 * [payment_gross] => the amount paid
 * [mc_currency] => the type of currency (USD)
 * [item_name] => the item name (Chinese Hack Code, English Hack Code)
 * @param $data     the array returned from the pdt function
 * @param $mysql    the mysql connection
 * @return          the code or invalid transaction ID message
 */
function id_to_code($data, $mysql)
{
    //check payment reciever's emails
    if ($data[receiver_email] !== "hi@qq.com" && $data[receiver_email] !== "h2i@qq.com") {
        return "Looks like you paid the wrong person...";
    }
    //check currency type
    if ($data[mc_currency] !== "USD") {
        return "We like USD. Pay in USD.";
    }
    //set timezone to pdt
    date_default_timezone_set('America/Vancouver');
    //today's date
    $month = jdmonthname(gregoriantojd(date(m), 13, 1998), 0);
    $this_date = jdmonthname($jd, 0) . " " . date(Y) . " PDT";
    //date of purchase
    $payment_date = $data[payment_date];
    $payment_date1 = substr($payment_date, -9);
    $payment_date2 = substr($payment_date, 9, 3);
    /*check time of purchase
    	if ( strcmp($this_date, $payment_date2 . $payment_date1) !== 0)
    	{
    		return "You're a little late on redeeming...";
    	}
    	*/
    //check kind of item
    if ($data[item_name] == "somethin") {
        $db = mysql_select_db("somethin", $mysql);
    } else {
        if ($data[item_name] == "somethin2") {
            $db = mysql_select_db("somethin2", $mysql);
        } else {
            return "We're not sure what you bought...";
        }
    }
    //check amount paid
    if ($data[payment_gross] == 20.0) {
        $table = "20";
    } else {
        if ($data[payment_gross] == 7.0) {
            $table = "7";
        } else {
            if ($data[payment_gross] == 2.0) {
                $table = "2";
            } else {
                return "You paid an incorrect amount...";
            }
        }
    }
    //look around table for code that has matching transaction ID
    $result = mysql_query("SELECT * FROM `{$table}` WHERE `id` LIKE '{$data['txn_id']}' LIMIT 1");
    //if there is none found, make a new entry
    if (mysql_num_rows($result) == 0) {
        mysql_query("UPDATE `{$table}` SET id='{$data['txn_id']}',date='{$data['payment_date']}',ip='{$ip}' WHERE `id` LIKE '' LIMIT 1");
        $result = mysql_query("SELECT * FROM `{$table}` WHERE `id` LIKE '{$data['txn_id']}' LIMIT 1");
    }
    //get the row that the transaction ID is found on and return the cod value
    $row = mysql_fetch_array($result);
    return $row['cod'];
}
开发者ID:rei2hu,项目名称:php_functions,代码行数:71,代码来源:process_paypal_data.php

示例3: postAdd

 public function postAdd()
 {
     $mulai = Input::get('start');
     $selesai = Input::get('finish');
     //pecah tanggal mulai
     $pecah_mulai = explode('/', $mulai);
     $hari_mulai = $pecah_mulai[1];
     $bulan_mulai = $pecah_mulai[0];
     $tahun_mulai = $pecah_mulai[2];
     //pecah tanggal selesai
     $pecah_selesai = explode('/', $selesai);
     $hari_selesai = $pecah_selesai[1];
     $bulan_selesai = $pecah_selesai[0];
     $tahun_selesai = $pecah_selesai[2];
     $cuti_mulai = gregoriantojd($bulan_mulai, $hari_mulai, $tahun_mulai);
     $cuti_selesai = gregoriantojd($bulan_selesai, $hari_selesai, $tahun_selesai);
     $selisi = $cuti_selesai - $cuti_mulai + 1;
     $libur = 0;
     for ($x = 1; $x <= $selisi; $x++) {
         $hitung_waktu = mktime(0, 0, 0, $bulan_mulai, $hari_mulai + $x, $tahun_mulai);
         if (date('w', $hitung_waktu) == 0 || date('w', $hitung_waktu) == 6) {
             $libur++;
         }
     }
     $jumlah_curi = $selisi - $libur;
     $cuti = Request::all();
     $cuti['period'] = $jumlah_curi;
     $query = Leave::create($cuti);
     $query == true ? $message = 'Berhasil tambah data' : ($message = 'Gagal tambah data');
     return redirect('leave')->with('message', $message);
 }
开发者ID:erwinmardinata,项目名称:app-cuti-sederhana-laravel5,代码行数:31,代码来源:LeaveController.php

示例4: isHoliday

 function isHoliday($date)
 {
     // insert your favorite holidays here
     $this->JDtoYMD($date, $year, $month, $day);
     if ($date == easter_days($year) + $this->MDYtoJD(3, 21, $year)) {
         $noSchool = false;
         return "Easter";
     }
     if ($date == easter_days($year) + $this->MDYtoJD(3, 21, $year) - 2) {
         $noSchool = false;
         return "Good Friday";
     }
     $jewishDate = explode("/", jdtojewish(gregoriantojd($month, $day, $year)));
     $month = $jewishDate[0];
     $day = $jewishDate[1];
     if ($month == 1 && $day == 1) {
         return "Rosh Hashanah";
     }
     if ($month == 1 && $day == 2) {
         return "Rosh Hashanah";
     }
     if ($month == 1 && $day == 10) {
         return "Yom Kippur";
     }
     if ($month == 3 && $day == 25) {
         return "Chanukkah";
     }
     if ($month == 8 && $day == 15) {
         return "Passover";
     }
     // call the base class for USA holidays
     return parent::isHoliday($date);
 }
开发者ID:rohmad-st,项目名称:fpdf,代码行数:33,代码来源:ex.php

示例5: getDateJewishCalendar

/**
 * Returns the current date in gregorian and hebrew
 *
 * The $params array can receive the parameters as follows:
 * ['gregorianDate']   -> Timestamped Gregorian Date
 * ['hebrewCaracters'] -> Returns the date in hebrew caracters. The param must be a boolean (true or false)
 *
 * @param array $params
 * @return string
 */
function getDateJewishCalendar(array $params)
{
    $gregorianDate = date('d/m/Y', $params['gregorianDate']);
    list($gregorianDay, $gregorianMonth, $gregorianYear) = explode('/', $gregorianDate);
    // Converting gregorian to julian date
    $julianDate = gregoriantojd($gregorianMonth, $gregorianDay, $gregorianYear);
    // Getting the Hebrew Month name
    $hebrewMonthName = jdmonthname($julianDate, 4);
    // Converting the date from Julian to Jewish.
    $jewishDate = jdtojewish($julianDate);
    list($jewishMonth, $jewishDay, $jewishYear) = explode('/', $jewishDate);
    $jewishDateStr = "";
    $jewishDateStr = "{$gregorianDate}&nbsp; - &nbsp;";
    $jewishDateStr .= "{$jewishDay} {$hebrewMonthName} {$jewishYear}";
    if ($params['hebrewCaracters'] === true) {
        // Converting the date from Julian to Jewish, but in hebrew caracters
        $hebrewDate = jdtojewish($julianDate, true);
        /*
         * This plugin is UTF8 only and the jdtojewish function only return iso,
         * so we need to convert it with mb_string, mb_convert_encoding function.
         */
        $jewishDateStr .= "&nbsp; - &nbsp;" . mb_convert_encoding(jdtojewish($julianDate, true), "UTF-8", "ISO-8859-8");
    }
    return $jewishDateStr;
}
开发者ID:adlermedrado,项目名称:adlercalendartranslator,代码行数:35,代码来源:adlercalendartranslator.php

示例6: daysBetweenDate

function daysBetweenDate($from, $till)
{
    /*
     *This function will calculate the difference between two given dates.
     *
     *Please input time by ISO 8601 standards (yyyy-mm-dd).
     *i.e: daysBetweenDate('2009-01-01', '2010-01-01');
     *This will return 365.
     *
     *Author: brian [at] slaapkop [dot] net
     *May 5th 2010
    */
    if ($till < $from) {
        trigger_error("The date till is before the date from", E_USER_NOTICE);
    }
    //Explode date since gregoriantojd() requires mm, dd, yyyy input;
    $from = explode('-', $from);
    $till = explode('-', $till);
    //Calculate date to Julian Day Count with freshly created array $from.
    $from = gregoriantojd($from[1], $from[2], $from[0]) . "<br />";
    //Calculate date to Julian Day Count with freshly created array $till.
    $till = gregoriantojd($till[1], $till[2], $till[0]) . "<br />";
    //Substract the days $till (largest number) from $from (smallest number) to get the amount of days
    $days = $till - $from;
    //Return the number of days.
    return $days;
    //Isn't it sad how my comments use more lines than the actual code?
}
开发者ID:raju99,项目名称:sparkswap,代码行数:28,代码来源:functions.php

示例7: __construct

 public function __construct(DateTime $date = null)
 {
     if (!$date) {
         $date = new DateTime();
     }
     list($month, $day, $year) = explode('-', $date->format('m-d-Y'));
     list($this->month, $this->day, $this->year) = explode('/', jdtojewish(gregoriantojd($month, $day, $year)));
 }
开发者ID:baruchlane,项目名称:groupme-bots,代码行数:8,代码来源:HebrewDate.php

示例8: dateDiff

function dateDiff($dformat, $endDate, $beginDate)
{
    $date_parts1 = explode($dformat, $beginDate);
    $date_parts2 = explode($dformat, $endDate);
    $start_date = gregoriantojd($date_parts1[1], $date_parts1[2], $date_parts1[0]);
    $end_date = gregoriantojd($date_parts2[1], $date_parts2[2], $date_parts2[0]);
    return $end_date - $start_date;
}
开发者ID:patmark,项目名称:care2x-tz,代码行数:8,代码来源:labor-data-makegraph.php

示例9: getDate

 function getDate($date, $now)
 {
     date_default_timezone_set('Asia/Taipei');
     $date1 = date_parse($date);
     $date2 = explode("-", $now);
     $start = gregoriantojd($date1['month'], $date1['day'], $date1['year']);
     $end = gregoriantojd($date2[0], $date2[1], $date2[2]);
     return $end - $start == 0 ? "Today" : $end - $start . " days ago";
 }
开发者ID:neobradley,项目名称:siglo_app,代码行数:9,代码来源:html.class.php

示例10: daysDifference

 function daysDifference($beginDate, $endDate)
 {
     //explode the date by "-" and storing to array
     $date_parts1 = explode("-", $beginDate);
     $date_parts2 = explode("-", $endDate);
     //gregoriantojd() Converts a Gregorian date to Julian Day Count
     $start_date = gregoriantojd($date_parts1[1], $date_parts1[2], $date_parts1[0]);
     $end_date = gregoriantojd($date_parts2[1], $date_parts2[2], $date_parts2[0]);
     return $end_date - $start_date;
 }
开发者ID:ankaau,项目名称:GathBandhan,代码行数:10,代码来源:ajaxcalendar.php

示例11: dateDiff

 public static function dateDiff($dformat, $endDate, $beginDate)
 {
     # Calculates difference between two dates
     # Input date format m, d, Y
     $date_parts1 = explode($dformat, $beginDate);
     $date_parts2 = explode($dformat, $endDate);
     $start_date = gregoriantojd($date_parts1[0], $date_parts1[1], $date_parts1[2]);
     $end_date = gregoriantojd($date_parts2[0], $date_parts2[1], $date_parts2[2]);
     return $end_date - $start_date;
 }
开发者ID:caseyi,项目名称:BLIS,代码行数:10,代码来源:date_lib.php

示例12: getJDN

 /**
  * Get Julian Day Number.
  * 
  * @param null|DateTime $DateTime Date (optional)
  * @return int
  */
 public static function getJDN(DateTime $DateTime = null)
 {
     if (is_null($DateTime)) {
         $DateTime = new DateTime('now');
     }
     $year = $DateTime->format('Y');
     $month = $DateTime->format('n');
     $day = $DateTime->format('j');
     $JDN = gregoriantojd($month, $day, $year);
     return (int) $JDN;
 }
开发者ID:mykitty,项目名称:jyotish,代码行数:17,代码来源:Time.php

示例13: dateDiff

 public static function dateDiff($startDate, $endDate)
 {
     // Parse dates for conversion
     $startArry = date_parse($startDate);
     $endArry = date_parse($endDate);
     // Convert dates to Julian Days
     $start_date = gregoriantojd($startArry["month"], $startArry["day"], $startArry["year"]) - 1;
     $end_date = gregoriantojd($endArry["month"], $endArry["day"], $endArry["year"]);
     // Return difference
     return round($end_date - $start_date, 0);
 }
开发者ID:lejacome,项目名称:hospital-mgt,代码行数:11,代码来源:Utility.php

示例14: dateDiff

function dateDiff($startDate, $endDate)
{
    // Parse dates for conversion
    $startArry = date_parse($startDate);
    $endArry = date_parse($endDate);
    // Convert dates to Julian Days
    $start_date = gregoriantojd($startArry['month'], $startArry['day'], $startArry['year']);
    $end_date = gregoriantojd($endArry['month'], $endArry['day'], $endArry['year']);
    // Return difference
    return round($end_date - $start_date, 0);
}
开发者ID:alienfault,项目名称:ossim,代码行数:11,代码来源:login.php

示例15: strGregToHeb

function strGregToHeb($strDate, $hebrew = false, $bornAtNight = false)
{
    if ($bornAtNight) {
        $strDate = date("M d, Y", strtotime($strDate . " +1 day"));
    }
    $tDate = getdate(strtotime($strDate));
    $hebdate = jdtojewish(gregoriantojd($tDate['mon'], $tDate['mday'], $tDate['year']), $hebrew);
    if ($hebrew) {
        return iconv("ISO-8859-8", "UTF-8", $hebdate);
    } else {
        return $hebdate;
    }
}
开发者ID:BGCX067,项目名称:facebook-jewishdates-svn-to-git,代码行数:13,代码来源:jDateFunctions.php


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