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


PHP Carbon::format方法代码示例

本文整理汇总了PHP中Carbon::format方法的典型用法代码示例。如果您正苦于以下问题:PHP Carbon::format方法的具体用法?PHP Carbon::format怎么用?PHP Carbon::format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Carbon的用法示例。


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

示例1: ReportAffiliate

 public function ReportAffiliate($token)
 {
     $header = array(array('INSTITUCION DE PREVISION SOCIAL DEL PERIODISTA'), array('Carnet: ', '', ' Fecha Nacimiento: ', ' ', 'Edad: ', 'Fecha Ingreso: '), array('Nombre: '), array('Tiempo de jubilación Voluntaria: '), array('Tiempo de jubilación Obligatorio: '), array('Pago de Cuotas Sector Privado '), array(''), array('Año', 'Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'));
     $dues = $this->duesRepository->getModel()->where('affiliate_id', $affiliate->id)->orderBy('date_payment', 'ASC')->get();
     if (!$dues->isEmpty()) {
         //"01/01/1995"
         $old_year = Carbon::format($dues[0]->date_payment)->getFullYear();
         //1995
         $last_year = Carbon::format($dues[count($dues) - 1])->getFullYear();
         //2014
         for ($i = $old_year; $i <= $last_year; $i++) {
             $row[] = $i;
             for ($j = 1; $j <= 12; $j++) {
                 # code...
                 foreach ($dues as $key => $value) {
                     if ($value->date_payment == "01/" . $j . "/" . $i) {
                         array_push($row, $value->amount);
                     } else {
                         array_push($row, "");
                     }
                 }
             }
             array_push($header, $row);
         }
     }
     echo json_encode($header);
     die;
     /*   foreach ($dues as $due) {
              $duesYear =  $this->duesRepository->getModel()->where('date_payment',$affiliate->id)->where('affiliate_id',$affiliate->id)->orderBy('date_payment','ASC')->get();
              foreach(){
                  $header[] = ['Año','Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre'];
              }
              
          }*/
 }
开发者ID:asarmiento,项目名称:CPHon,代码行数:35,代码来源:ReportExcelController.php

示例2: niceDateRange

 public function niceDateRange(Carbon $date1 = null, Carbon $date2 = null, $ordinalSuffixRequired = false)
 {
     $ordinalSuffix = "";
     $day1 = $date1->day;
     $day2 = $date2->day;
     $month1 = $date1->month;
     $month2 = $date2->month;
     //$ordinalSuffix = FormatMe::toOrdinalSuffix($day2);
     $restOfDate = $date2->format('F Y');
     $myDateString = "{$day1}-{$day2}" . $ordinalSuffix;
     // if months are not the same, display both months in range
     if ($month1 !== $month2) {
         return "{$day1} " . $date1->format('F') . " &ndash; " . "{$day2} " . $date2->format('F Y');
     }
     return $myDateString . ' ' . $restOfDate;
 }
开发者ID:wdmtech,项目名称:php-helpers,代码行数:16,代码来源:DateHelpers.php

示例3: dueDate

 public function dueDate()
 {
     $settings = APSetting::first();
     $generated_on = new Carbon($this->generated_on);
     $generated_on->addDays($settings->payment_due_in_days);
     return $generated_on->format('d M y');
 }
开发者ID:guilhermefilippo,项目名称:access-manager,代码行数:7,代码来源:APInvoice.php

示例4: calculateHolidays

 private function calculateHolidays($country, $fromYear, $toYear)
 {
     $return = [];
     if ($fromYear == $toYear) {
         $years = [$fromYear];
     } else {
         $years = [$fromYear, $toYear];
     }
     foreach ($years as $year) {
         $country_file = dirname(__DIR__) . '/data/' . $country . '.json';
         $countryHolidays = json_decode(file_get_contents($country_file), true);
         foreach ($countryHolidays as $countryHoliday) {
             if (strstr($countryHoliday['rule'], '%Y')) {
                 $rule = str_replace('%Y', $year, $countryHoliday['rule']);
             } elseif (strstr($countryHoliday['rule'], '%EASTER')) {
                 $date = new Carbon($year . '-03-21 +' . easter_days($year) . ' days');
                 $rule = str_replace('%EASTER', $date->format('Y-m-d'), $countryHoliday['rule']);
             } elseif (in_array($country, ['BR', 'US']) && strstr($countryHoliday['rule'], '%ELECTION')) {
                 $rule = $this->calculateElectionDay($country, $years, $year, $countryHoliday);
             } else {
                 $rule = $countryHoliday['rule'] . ' ' . $year;
             }
             if ($rule) {
                 $return[] = ['name' => $countryHoliday['name'], 'date' => new Carbon($rule)];
             }
         }
     }
     return $return;
 }
开发者ID:EventBooking,项目名称:holidayapi.com,代码行数:29,代码来源:HolidayAPIv1.php

示例5: isBirthday

 /**
  * Check if its the birthday. Compares the date/month values of the two dates.
  *
  * @param Carbon $dt
  *
  * @return boolean
  */
 public function isBirthday(Carbon $dt)
 {
     return $this->format('md') === $dt->format('md');
 }
开发者ID:limferdi,项目名称:soccerStadiumReservation,代码行数:11,代码来源:Carbon.php

示例6: migrarRecaudosSolicitud

 private function migrarRecaudosSolicitud()
 {
     $this->info("Migrando recaudos de la solicitud");
     $this->getTable('recaudos_solicitud')->chunk(1000, function ($recaudos) {
         foreach ($recaudos as $recaudo) {
             $this->info("Migrando recaudo de la solicitud: " . $recaudo->codrecaudo);
             $recaudoNuevo = new RecaudoSolicitud();
             $recaudoNuevo->recaudo_id = $recaudo->codrecaudo;
             $recaudoNuevo->solicitud_id = $recaudo->idsolicitud;
             $recaudoNuevo->ind_recibido = $recaudo->indrecibido == 'S';
             if ($recaudo->fecvencimiento != '') {
                 $carbon = new Carbon($recaudo->fecvencimiento);
                 $recaudoNuevo->fecha_vencimiento = $carbon->format('d/m/Y');
             }
             $recaudoNuevo->save();
         }
     });
 }
开发者ID:armandolazarte,项目名称:sasyc,代码行数:18,代码来源:MigrarSasyc.php

示例7: formatTime

 function formatTime(Carbon $time)
 {
     return $time->format('H:i');
 }
开发者ID:codebreez,项目名称:collejo-core,代码行数:4,代码来源:helpers.php


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