本文整理汇总了PHP中gregoriantojd函数的典型用法代码示例。如果您正苦于以下问题:PHP gregoriantojd函数的具体用法?PHP gregoriantojd怎么用?PHP gregoriantojd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了gregoriantojd函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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] !== "[email protected]" && $data[receiver_email] !== "[email protected]") {
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} - ";
$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 .= " - " . 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
示例16: interestcalculation
public function interestcalculation($fdate, $ldate, $trnsdate, $bal, $loaninterest, $installmentid)
{
$len = count($trnsdate);
for ($i = 0; $i < $len; $i++) {
$be[] = explode('-', $trnsdate[$i]);
//exploding
$gr[] = gregoriantojd($be[$i][1], $be[$i][2], $be[$i][0]);
//gregorian format
}
// echo "len".$len;
$fdateexp = explode('-', $fdate);
$fdatevalue = gregoriantojd($fdateexp[1], $fdateexp[2], $fdateexp[0]);
//gregorian format
$ldateexp = explode('-', $ldate);
$ldatevalue = gregoriantojd($ldateexp[1], $ldateexp[2], $ldateexp[0]);
//gregorian format
// //find difference between transaction date
$interest = 0;
$balance = 0;
if ($len == 0) {
if ($installmentid[0] != 1) {
$diff = $gr[0] - $fdatevalue;
$interest += $diff * $bal[0] * $loaninterest / 100 * 1 / 365;
$diff = $ldatevalue - $gr[0];
$interest += $diff * $bal[0] * $loaninterest / 100 * 1 / 365;
$balance += round($bal[0] + $interest, 2);
} else {
$diff = $ldatevalue - $gr[0];
$interest += $diff * $bal[0] * $loaninterest / 100 * 1 / 365;
$balance += round($bal[0] + $interest, 2);
}
} else {
for ($k = 0; $k < $len; $k++) {
if ($k == 0) {
if ($installmentid[$k] != 1) {
$diff = $gr[$k] - $fdatevalue;
$interest += $diff * $bal[$k] * $loaninterest / 100 * 1 / 365;
}
}
if ($k != $len and $k != 0) {
$diffdate = $gr[$k] - $gr[$k - 1];
$interest += $diffdate * $bal[$k] * $loaninterest / 100 * 1 / 365;
}
}
$diff = $ldatevalue - $gr[$len - 1];
$interest += $diff * $bal[$len - 1] * $loaninterest / 100 * 1 / 365;
$balance += round($bal[$len - 1] + $interest, 2);
}
$result = array(round($interest, 2), $balance);
return $result;
}
开发者ID:maniargaurav,项目名称:OurBank,代码行数:51,代码来源:Transaction.php
示例17: 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
示例18: querycrit
function querycrit($dbname,$dbname2,$sdate,$edate,$brgy,$misc){
$sdate_orig = trim($sdate);
$edate_orig = trim($edate);
list($smonth,$sday,$syr) = explode('/',$sdate);
list($emonth,$eday,$eyr) = explode('/',$edate);
$smonth = (strlen($smonth)==1)?(str_pad($smonth,2,'0',STR_PAD_LEFT)):$smonth;
$emonth = (strlen($emonth)==1)?(str_pad($emonth,2,'0',STR_PAD_LEFT)):$emonth;
$sdate = $syr.'-'.$smonth.'-'.$sday;
$edate = $eyr.'-'.$emonth.'-'.$eday;
$start_date=gregoriantojd($smonth, $sday, $syr);
$end_date=gregoriantojd($emonth, $eday, $eyr);
$diff = $end_date - $start_date;
if(empty($sdate) || empty($edate)):
echo "Please supply a date.";
elseif($frage>$toage):
echo "Start age should be lower than end age.";
elseif($diff < 0):
echo 'End month should be on or after the start month';
elseif(empty($brgy)):
echo 'Please select one or more barangays.';
else:
echo "<br><table border=\"1\">";
$_SESSION[sdate] = $sdate.' 00:00:00';
$_SESSION[edate] = $edate.' 23:59:59';
$_SESSION[brgy] = $brgy;
$_SESSION[edate2] = $edate;
$_SESSION[sdate2] = $sdate;
$_SESSION[sdate_orig] = $sdate_orig;
$_SESSION[edate_orig] = $edate_orig;
$_SESSION[fp_method] = (isset($misc))?$misc:0; //assign fp method to a session if it exists from the form, otherwise place 0
$this->stat_table($q,$_SESSION[ques]);
endif;
echo "</table>";
}
开发者ID:angelogarcia,项目名称:chits,代码行数:50,代码来源:class.querydb.php
示例19: daysDifference
function daysDifference($endDate, $beginDate)
{
/*
returned verschil in dagen
date format string “YYYY-MM-DD”,
*/
//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:rvaliev,项目名称:Plantenshop,代码行数:14,代码来源:functies.inc.php
示例20: years
static function years($date)
{
###http://www.php.net/date :: [email protected]
list($year, $mon, $day) = explode("-", $date);
$today = getdate(time());
// find the difference in the years of the two dates
$yeardiff = $today['year'] - $year;
// if the current date occurs before the birthday, subtract one
$birth_jd = gregoriantojd($mon, $day, $today['year']);
$today_jd = gregoriantojd($today['mon'], $today['mday'], $today['year']);
if ($today_jd < $birth_jd) {
$yeardiff--;
}
return $yeardiff;
}
开发者ID:reneolivo,项目名称:PHP-Toolkit,代码行数:15,代码来源:calendar.php
注:本文中的gregoriantojd函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论