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


PHP cal_to_jd函数代码示例

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


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

示例1: __construct

 function __construct($month = null, $year = null)
 {
     $this->month = $month | date('n');
     $this->year = $year | date('Y');
     $this->dim = cal_days_in_month(CAL_GREGORIAN, $this->month, $this->year);
     $this->msw = jddayofweek(cal_to_jd(CAL_GREGORIAN, $this->month, 1, $this->year));
 }
开发者ID:rev087,项目名称:kennel,代码行数:7,代码来源:calendar.php

示例2: incrementViewCount

 private function incrementViewCount($id)
 {
     $this->Post->updateAll(array('Post.viewed' => 'Post.viewed+1'), array('Post.id' => $id));
     $this->loadModel('PostTrend');
     $day = jddayofweek(cal_to_jd(CAL_GREGORIAN, date("m"), date("d"), date("Y")), 1);
     $this->PostTrend->updateAll(array('PostTrend.' . $day => 'PostTrend.' . $day . '+1'), array('PostTrend.post_id' => $id));
 }
开发者ID:CHrycyna,项目名称:StMarysWebsite_2.0,代码行数:7,代码来源:PostsController.php

示例3: getweekday

 function getweekday($params)
 {
     $params_thang_nam = explode('/', $params);
     $params = $params_thang_nam[0];
     $thang = $params_thang_nam[1];
     $nam = $params_thang_nam[2];
     $jd = cal_to_jd(CAL_GREGORIAN, $thang, $params, $nam);
     $day = jddayofweek($jd, 0);
     switch ($day) {
         case 0:
             $thu = "Chủ nhật";
             break;
         case 1:
             $thu = "Thứ hai";
             break;
         case 2:
             $thu = "Thứ ba";
             break;
         case 3:
             $thu = "Thứ tư";
             break;
         case 4:
             $thu = "Thứ năm";
             break;
         case 5:
             $thu = "Thứ sáu";
             break;
         case 6:
             $thu = "Thứ bảy";
             break;
     }
     return $thu;
 }
开发者ID:shopgolf,项目名称:abc,代码行数:33,代码来源:bookinglib.php

示例4: julianDateValue

 /**
  * Get Julian date value and return it as Gregorian date
  *
  * @param string $dateValue
  *
  * @return string|null Value compatible with xsd:dateTime type, null if we failed to parse
  */
 private function julianDateValue($dateValue)
 {
     try {
         list($minus, $y, $m, $d, $time) = $this->parseDateValue($dateValue);
     } catch (IllegalValueException $e) {
         return null;
     }
     // We accept here certain precision loss since we will need to do calculations anyway,
     // and we can't calculate with dates that don't fit in int.
     $y = $minus ? -(int) $y : (int) $y;
     // cal_to_jd needs int year
     // If it's too small it's fine, we'll get 0
     // If it's too big, it doesn't make sense anyway,
     // since who uses Julian with day precision in year 2 billion?
     $jd = cal_to_jd(CAL_JULIAN, $m, $d, (int) $y);
     if ($jd == 0) {
         // that means the date is broken
         return null;
     }
     // PHP API for Julian/Gregorian conversions is kind of awful
     list($m, $d, $y) = explode('/', jdtogregorian($jd));
     if ($this->xsd11 && $y < 0) {
         // To make year match XSD 1.1 we need to bump up the negative years by 1
         // We know we have precision here since otherwise we wouldn't convert
         $y++;
     }
     // This is a bit weird since xsd:dateTime requires >=4 digit always,
     // and leading 0 is not allowed for 5 digits, but sprintf counts - as digit
     // See: http://www.w3.org/TR/xmlschema-2/#dateTime
     return sprintf('%s%04d-%02d-%02dT%s', $y < 0 ? '-' : '', abs($y), $m, $d, $time);
 }
开发者ID:Benestar,项目名称:mediawiki-extensions-Wikibase,代码行数:38,代码来源:JulianDateTimeValueCleaner.php

示例5: getWeekday

 function getWeekday($user_input)
 {
     //Converts user input to array
     $date = explode("/", $user_input);
     //Insert array to appropriate are to format to julian day
     $jul_date = cal_to_jd(CAL_GREGORIAN, (int) $date[0], (int) $date[1], (int) $date[2]);
     //Whats the date?
     $output = jddayofweek($jul_date, 1);
     return $output;
 }
开发者ID:anniehoogendoorn,项目名称:WeekdayFinder,代码行数:10,代码来源:WeekdayFinder.php

示例6: GregorianToHijri

 function GregorianToHijri($time = null)
 {
     if ($time === null) {
         $time = time();
     }
     $m = date('m', $time);
     $d = date('d', $time);
     $y = date('Y', $time);
     return HijriCalendar::JDToHijri(cal_to_jd(CAL_GREGORIAN, $m, $d, $y));
 }
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:10,代码来源:calendars.php

示例7: formatDate

 function formatDate($greg_date)
 {
     $greg_array = explode("-", $greg_date);
     $int_array = array();
     foreach ($greg_array as $token) {
         array_push($int_array, (int) $token);
     }
     if ($int_array[2] == 0 || $int_array[1] == 0 || $int_array[0] == 0) {
         return 0;
     }
     return cal_to_jd(CAL_GREGORIAN, $int_array[1], $int_array[2], $int_array[0]);
 }
开发者ID:r-hills,项目名称:Day_Of_Week,代码行数:12,代码来源:DOW.php

示例8: executeCargarReservaciones

 public function executeCargarReservaciones(sfWebRequest $request)
 {
     date_default_timezone_set("America/Guayaquil");
     $dia = jddayofweek(cal_to_jd(CAL_GREGORIAN, date("m"), date("d"), date("Y")), 0);
     //        $tDesde=time()-600;
     //        $tHasta=time()-540;
     //        $hDesde=date('H:i:s',$tDesde);
     //        $hHasta=date('H:i:s',$tHasta);
     switch ($dia) {
         case '1':
             $reservacion = Doctrine_Core::getTable('reservacion')->createQuery('c')->where('c.lunes=?', true)->execute();
             break;
         case '2':
             $reservacion = Doctrine_Core::getTable('reservacion')->createQuery('c')->where('c.martes=?', true)->execute();
             break;
         case '3':
             $reservacion = Doctrine_Core::getTable('reservacion')->createQuery('c')->where('c.miercoles=?', true)->execute();
             break;
         case '4':
             $reservacion = Doctrine_Core::getTable('reservacion')->createQuery('c')->where('c.jueves=?', true)->execute();
             break;
         case '5':
             $reservacion = Doctrine_Core::getTable('reservacion')->createQuery('c')->where('c.viernes=?', true)->execute();
             break;
         case '6':
             $reservacion = Doctrine_Core::getTable('reservacion')->createQuery('c')->where('c.sabado=?', true)->execute();
             break;
         case '0':
             $reservacion = Doctrine_Core::getTable('reservacion')->createQuery('c')->where('c.domingo=?', true)->execute();
             break;
         default:
             break;
     }
     $dataJson = array();
     foreach ($reservacion as $reser) {
         if ($reser->getHorario1()) {
             if (Operaciones::esHoraReservacion($reser->getHorario1(), date('H:i:s'))) {
                 $dataJson[] = array('id' => $reser->getId(), 'barrio' => $reser->getCodigo()->getSector()->getNombre(), 'calle1' => $reser->getCodigo()->getCalle1(), 'calle2' => $reser->getCodigo()->getCalle2(), 'cliente' => $reser->getCodigo()->getNombreCliente(), 'hora' => $reser->getHorario1(), 'codigo' => $reser->getCodigo()->getNumero(), 'idcodigo' => $reser->getCodigo()->getId(), 'idsector' => $reser->getCodigo()->getBarrio(), 'latitud' => $reser->getCodigo()->getLatitud(), 'longitud' => $reser->getCodigo()->getLongitud(), 'referencia' => $reser->getCodigo()->getObservacion());
             }
         }
         if ($reser->getHorario2()) {
             if (Operaciones::esHoraReservacion($reser->getHorario2(), date('H:i:s'))) {
                 $dataJson[] = array('id' => $reser->getId(), 'barrio' => $reser->getCodigo()->getSector()->getNombre(), 'calle1' => $reser->getCodigo()->getCalle1(), 'calle2' => $reser->getCodigo()->getCalle2(), 'cliente' => $reser->getCodigo()->getNombreCliente(), 'hora' => $reser->getHorario2(), 'codigo' => $reser->getCodigo()->getNumero(), 'idcodigo' => $reser->getCodigo()->getId(), 'idsector' => $reser->getCodigo()->getBarrio(), 'latitud' => $reser->getCodigo()->getLatitud(), 'longitud' => $reser->getCodigo()->getLongitud(), 'referencia' => $reser->getCodigo()->getObservacion());
             }
         }
         if ($reser->getHorario3()) {
             if (Operaciones::esHoraReservacion($reser->getHorario3(), date('H:i:s'))) {
                 $dataJson[] = array('id' => $reser->getId(), 'barrio' => $reser->getCodigo()->getSector()->getNombre(), 'calle1' => $reser->getCodigo()->getCalle1(), 'calle2' => $reser->getCodigo()->getCalle2(), 'cliente' => $reser->getCodigo()->getNombreCliente(), 'hora' => $reser->getHorario3(), 'codigo' => $reser->getCodigo()->getNumero(), 'idcodigo' => $reser->getCodigo()->getId(), 'idsector' => $reser->getCodigo()->getBarrio(), 'latitud' => $reser->getCodigo()->getLatitud(), 'longitud' => $reser->getCodigo()->getLongitud(), 'referencia' => $reser->getCodigo()->getObservacion());
             }
         }
     }
     return $this->renderText(json_encode($dataJson));
 }
开发者ID:edulima1989,项目名称:Sistema-Radiotaxi,代码行数:53,代码来源:actions.class.php

示例9: checkCalendar

 function checkCalendar($date)
 {
     //Explodes input string into array.
     $straight_date = explode('-', $date);
     //Converts array into Julian Day number.
     $jd_date = cal_to_jd(CAL_GREGORIAN, $straight_date[1], $straight_date[2], $straight_date[0]);
     //Converts Julian Day into day of week.
     $day_of_week = jddayofweek($jd_date, 1);
     if ($day_of_week == "Monday") {
         return $day_of_week . "; that sucks!";
     } else {
         return $day_of_week;
     }
 }
开发者ID:kylepratuch,项目名称:calendar_day,代码行数:14,代码来源:Calendar.php

示例10: buscarPromo

 public static function buscarPromo($codigo_plan)
 {
     $fecha_compra = Formatos::fechaHoraActual();
     $codigo_comercio = Persona::numeroComercio();
     $dia_semana = jddayofweek(cal_to_jd(CAL_GREGORIAN, date("m"), date("d"), date("Y")));
     $empresa = 1;
     $sucursal = 1;
     $sql = "\n\t\t\t\tSELECT TOP 1\n\t\t\t\t\t tarjetas_planes_promocion.nombre_plan as nombre,\n\t\t\t\t\t tarjetas_planes_promocion.vigencia_hasta as vencimiento\n\t\t\t\t  FROM tarjetas_planes_promocion\n\t\t\t\t WHERE nro_empresa  = {$empresa}\n\t\t\t\t\tAND nro_sucursal = {$sucursal}\n\t\t\t\t\tAND tarjetas_planes_promocion.codigo_plan = {$codigo_plan}\n\t\t\t\t\tAND Isnull( comercios_todos, 0 )  = 1\n\t\t\t\t\tAND (( IsNull( domingo\t, 0 ) \t= 1 AND 1 = {$dia_semana} ) or \n\t\t\t\t\t\t  ( IsNull( lunes\t, 0 ) \t= 1 AND 2 = {$dia_semana} ) or \n\t\t\t\t\t\t  ( IsNull( martes\t, 0 ) \t= 1 AND 3 = {$dia_semana} ) or \n\t\t\t\t\t\t  ( IsNull( miercoles, 0 ) \t= 1 AND 4 = {$dia_semana} ) or \n\t\t\t\t\t\t  ( IsNull( jueves\t, 0 ) \t= 1 AND 5 = {$dia_semana} ) or \n\t\t\t\t\t\t  ( IsNull( viernes\t, 0 ) \t= 1 AND 6 = {$dia_semana} ) or \n\t\t\t\t\t\t  ( IsNull( sabado\t, 0 ) \t= 1 AND 7 = {$dia_semana} ) ) \n\t\t\t\t\tAND vigencia_desde <= '{$fecha_compra}'\n\t\t\t\t\tAND vigencia_hasta >= '{$fecha_compra}'\n\t\t\t\t\tAND isnull(habilitado,0) = 1\n\n\t\t\t\tUNION ALL\n\n\t\t\t\tSELECT\n\t\t\t\t\t tarjetas_planes_promocion.nombre_plan AS nombre,\n\t\t\t\t\t tarjetas_planes_promocion.vigencia_hasta AS vencimiento\n\n\t\t\t\t  FROM tarjetas_planes_comercios\n\t\t\t\t  JOIN tarjetas_planes_promocion ON\n\t\t\t\t\t\t( tarjetas_planes_comercios.nro_empresa  \t  =  tarjetas_planes_promocion.nro_empresa AND\n\t\t\t\t\t\t  tarjetas_planes_comercios.nro_sucursal \t  =  tarjetas_planes_promocion.nro_sucursal \t AND\n\t\t\t\t\t\t  tarjetas_planes_comercios.codigo_plan  \t  =  tarjetas_planes_promocion.codigo_plan  \t AND\n\t\t\t\t\t\t  tarjetas_planes_comercios.vigencia_desde  =  tarjetas_planes_promocion.vigencia_desde AND\n\t\t\t\t\t\t  tarjetas_planes_comercios.cod_promocion\t  =  tarjetas_planes_promocion.cod_promocion\t )\n\n\t\t\t\t WHERE tarjetas_planes_comercios.nro_empresa  \t\t= {$empresa}\n\t\t\t\t\tAND tarjetas_planes_comercios.nro_sucursal \t\t= {$sucursal}\n\t\t\t\t\tAND tarjetas_planes_comercios.codigo_comercio \t= {$codigo_comercio}\n\n\t\t\t\t\tAND tarjetas_planes_comercios.codigo_plan \t\t= {$codigo_plan}\n\t\t\t\t\tAND (( IsNull( tarjetas_planes_promocion.domingo\t, 0 ) = 1 AND 1 = {$dia_semana} ) or \n\t\t\t\t\t\t  ( IsNull( tarjetas_planes_promocion.lunes\t\t, 0 ) = 1 AND 2 = {$dia_semana} ) or \n\t\t\t\t\t\t  ( IsNull( tarjetas_planes_promocion.martes\t, 0 ) = 1 AND 3 = {$dia_semana} ) or \n\t\t\t\t\t\t  ( IsNull( tarjetas_planes_promocion.miercoles\t, 0 ) = 1 AND 4 = {$dia_semana} ) or \n\t\t\t\t\t\t  ( IsNull( tarjetas_planes_promocion.jueves\t, 0 ) = 1 AND 5 = {$dia_semana} ) or \n\t\t\t\t\t\t  ( IsNull( tarjetas_planes_promocion.viernes\t, 0 ) = 1 AND 6 = {$dia_semana} ) or \n\t\t\t\t\t\t  ( IsNull( tarjetas_planes_promocion.sabado\t, 0 ) = 1 AND 7 = {$dia_semana} ) ) \n\n\t\t\t\t\tAND tarjetas_planes_comercios.vigencia_desde <= '{$fecha_compra}'\n\t\t\t\t\tAND tarjetas_planes_comercios.vigencia_hasta >= '{$fecha_compra}'\n\t\t\t\t\tAND isnull(tarjetas_planes_comercios.habilitado,0) = 1\n\t\t\t\t    AND isnull(tarjetas_planes_promocion.habilitado,0) = 1\n\t\t";
     $datos = DB::select($sql);
     if (count($datos) <= 0) {
         return 'no hay';
     }
     return $datos;
 }
开发者ID:robertomiguel,项目名称:autorizador,代码行数:14,代码来源:TarjetaPlanPromocion.php

示例11: contains

    public function contains(\DateTime $dateTime)
    {
        $value = ($this->day < 0) ? -1 : 1;

        $compare = clone $dateTime();

        $dayOfWeek = jddayofweek(cal_to_jd(CAL_GREGORIAN,
                                           $dateTime->format('m'),
                                           $dateTime->format('j'),
                                           $dateTime->format('Y')));

        return ($this->day == $dayOfWeek) &&
            ($compare->add((-1 * $this->day) . ' days')->format('m') != $dateTime->format('m')) &&
            ($compare->setDate($dateTime->getTimestamp())->add((-1 * $this->day) + $value)->format('m') == $dateTime->format('m'));
    }
开发者ID:regisg27,项目名称:CalendarBundle,代码行数:15,代码来源:DayOfTheMonth.php

示例12: contains

 public function contains(\DateTime $dateTime)
 {
     if ($this->ignoreDay) {
         if ($this->day > 0) {
             return $dateTime->format('j') == $this->day;
         } else {
             $calendarDays = cal_days_in_month(CAL_GREGORIAN, $dateTime->format('Y'), $dateTime->format('m'));
             return $calendarDays + 1 + $this->day === $dateTime->format('j');
         }
     } else {
         $value = $this->day < 0 ? -1 : 1;
         $compare = clone $dateTime();
         $dayOfWeek = jddayofweek(cal_to_jd(CAL_GREGORIAN, $dateTime->format('m'), $dateTime->format('j'), $dateTime->format('Y')));
         return $this->day == $dayOfWeek && $compare->add(-1 * $this->day . ' days')->format('m') != $dateTime->format('m') && $compare->setDate($dateTime->getTimestamp())->add(-1 * $this->day + $value)->format('m') == $dateTime->format('m');
     }
 }
开发者ID:robzienert,项目名称:TemporalExpression,代码行数:16,代码来源:DayOfTheMonth.php

示例13: index

 public function index()
 {
     $year = date("Y", time());
     $month = date("n", time());
     $day = date("j", time());
     $noOfThisWeek = jddayofweek(cal_to_jd(CAL_GREGORIAN, date("m"), date("d"), date("Y")), 0);
     if ($noOfThisWeek == 0) {
         $noOfThisWeek = 7;
     }
     $plus = 7 - $numOfday;
     $by = $noOfThisWeek - 1;
     $today_beginSec = mktime(0, 0, 0, $month, $day, $year);
     $today_lastSec = mktime(24, 0, 0, $month, $day, $year);
     $yestday_beginSec = mktime(0, 0, 0, $month, $day - 1, $year);
     $yestday_lastSec = mktime(24, 0, 0, $month, $day - 1, $year);
     $this_week_beginSec = mktime(0, 0, 0, $month, $day - $by, $year);
     $this_week_endSec = mktime(24, 0, 0, $month, $day + $plus, $year);
     $this_month_beginSec = mktime(0, 0, 0, $month, 1, $year);
     $this_month_endSec = mktime(0, 0, 0, $month + 1, 1, $year);
     $this_year_beginSec = mktime(0, 0, 0, 1, 1, $year);
     $this_year_endSec = mktime(0, 0, 0, 1, 1, $year + 1);
     $Inqueue = M("Inqueue");
     $Okin = M("Okin");
     $results_inqueue = $Inqueue->select();
     $results_okin_today = $Okin->where("`out_time` > {$today_beginSec} AND `out_time` < {$today_lastSec}")->select();
     $results_okin_yestoday = $Okin->where("`out_time` > {$yestday_beginSec} AND `out_time` < {$yestday_lastSec}")->select();
     $results_okin_this_week = $Okin->field('user_numb,user_name,sum(delay_time),avg(delay_time),count(user_numb)')->group('user_numb')->where("`out_time` > {$this_week_beginSec} AND `out_time` < {$this_week_endSec}")->select();
     $results_okin_this_month = $Okin->field('user_numb,user_name,sum(delay_time),avg(delay_time),count(user_numb)')->group('user_numb')->where("`out_time` > {$this_month_beginSec} AND `out_time` < {$this_month_endSec}")->select();
     $results_okin_this_year = $Okin->field('user_numb,user_name,sum(delay_time),avg(delay_time),count(user_numb)')->group('user_numb')->where("`out_time` > {$this_year_beginSec} AND `out_time` < {$this_year_endSec}")->select();
     //var_dump($results_okin_this_month);
     $this->assign('title', '签到统计');
     $this->assign('results_inqueue', $results_inqueue);
     $this->assign('results_okin_today', $results_okin_today);
     $this->assign('results_okin_yestoday', $results_okin_yestoday);
     $this->assign('results_okin_this_week', $results_okin_this_week);
     $this->assign('results_okin_this_month', $results_okin_this_month);
     $this->assign('results_okin_this_year', $results_okin_this_year);
     $this->display('index');
 }
开发者ID:Rusion-Wayne,项目名称:sign-in-system,代码行数:39,代码来源:CountController.class.php

示例14: loadHolidays

 public function loadHolidays()
 {
     $jdDate = cal_to_jd(CAL_GREGORIAN, date('m'), date('d'), date('Y'));
     $hebrewDate = jdtojewish($jdDate);
     list($hebrewMonth, $hebrewDay, $hebrewYear) = explode('/', $hebrewDate);
     $holidays = array();
     $currYear = $hebrewYear - 1;
     // subtract a year for some reason
     $nextYear = $currYear + 1;
     foreach ($this->holidays as $key => $val) {
         $julianDate = jewishtojd($val[0], $val[1], $currYear);
         if (jdtounix($julianDate) < time()) {
             $julianDate = jewishtojd($val[0], $val[1], $nextYear);
             if (jdtounix($julianDate) < time()) {
                 $julianDate = jewishtojd($val[0], $val[1], $nextYear + 1);
             }
         }
         $unixTime = jdtounix($julianDate);
         $unixTime += 86400;
         // add 1 day for some reason
         $holidays[$key] = '@' . $unixTime;
     }
     return $holidays;
 }
开发者ID:afischoff,项目名称:php-holiday-calculator,代码行数:24,代码来源:jewish_holidays.php

示例15: jddayofweek

     if ($adate['mon'] > 12) {
         $adate['year'] += 1;
         $adate['mon'] -= 12;
     }
     if ($my_repeat_on_num < 5) {
         // not last
         $adate['mday'] = 1;
         $dow = jddayofweek(cal_to_jd(CAL_GREGORIAN, $adate['mon'], $adate['mday'], $adate['year']));
         if ($dow > $my_repeat_on_day) {
             $dow -= 7;
         }
         $adate['mday'] += ($my_repeat_on_num - 1) * 7 + $my_repeat_on_day - $dow;
     } else {
         // last weekday of month
         $adate['mday'] = cal_days_in_month(CAL_GREGORIAN, $adate['mon'], $adate['year']);
         $dow = jddayofweek(cal_to_jd(CAL_GREGORIAN, $adate['mon'], $adate['mday'], $adate['year']));
         if ($dow < $my_repeat_on_day) {
             $dow += 7;
         }
         $adate['mday'] += $my_repeat_on_day - $dow;
     }
 } else {
     // recurrtype 1
     if ($repeattype == 0) {
         // daily
         $adate['mday'] += 1;
     } else {
         if ($repeattype == 1) {
             // weekly
             $adate['mday'] += 7;
         } else {
开发者ID:minggLu,项目名称:openemr,代码行数:31,代码来源:find_appt_popup.php


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