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


PHP Carbon::subMonth方法代码示例

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


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

示例1: getStartDateForPeriod

 /**
  * @param string $period
  *
  * @return Carbon
  */
 public function getStartDateForPeriod($period)
 {
     $start = new Carbon();
     switch ($period) {
         default:
         case 'month':
             $start->startOfDay();
             $start->subMonth();
             break;
         case 'year':
             $start->startOfMonth();
             $start->subYear();
             break;
     }
     return $start;
 }
开发者ID:JC5,项目名称:marauder,代码行数:21,代码来源:ChartHelper.php

示例2: define


//.........这里部分代码省略.........
         $pdf->Ln(27);
         $pdf->SetX(28);
         $pdf->Write(0, 'X');
         $pdf->Ln(18);
         $pdf->SetX(32);
         if ($rows['leave_type_id'] == 2) {
             $leave_name = '';
         }
         $pdf->SetFont('Arial', 'B', 10);
         $pdf->Write(0, $leave_name);
         $pdf->SetFont('Arial', 'B', 12);
     }
     $pdf->Ln(35);
     $pdf->SetXY(35, 128);
     $days = 'day';
     if ($rows['days'] > 1) {
         $days = 'days';
     }
     $pdf->Write(0, $rows['days'] . ' ' . $days);
     $date_leave = $this->Helps->get_month_name($rows['month']) . ' ' . $rows['multiple'] . ', ' . $rows['year'];
     if ($rows['multiple5'] != '') {
         $date_leave .= ' - ' . $this->Helps->get_month_name($rows['month5']) . ' ' . $rows['multiple5'] . ', ' . $rows['year5'];
     }
     $pdf->Ln(4);
     $pdf->SetX(60);
     $pdf->Write(0, $date_leave);
     $last_earn = $this->Leave_card->get_last_earn($rows['employee_id']);
     //$last_earn = date('F d, Y', strtotime($last_earn));
     if ($last_earn != '') {
         $record_limit_date = $last_earn;
         $last_earn = date('F d, Y', strtotime($last_earn));
     } else {
         $dt = new Carbon();
         $dt->subMonth();
         //echo 'last day of '. $this->Helps->get_month_name($dt->month).' '.$dt->year;
         $date = new Carbon('last day of ' . $this->Helps->get_month_name($dt->month) . ' ' . $dt->year);
         //return;
         $last_earn = $this->Helps->get_month_name($date->month) . ' ' . $date->day . ', ' . $date->year;
         $record_limit_date = $date->year . '-' . $date->month . '-' . $date->day;
         //$last_earn = date('F d, Y');
     }
     $credits = $this->Leave_card->get_total_leave_credits($rows['employee_id'], $record_limit_date);
     $pdf->Ln(39);
     $pdf->SetX(35);
     $pdf->Write(0, $last_earn);
     //balances
     $pdf->Ln(18);
     $pdf->SetX(25);
     //$pdf->Write(0, $vbalance);
     $pdf->Write(0, number_format($credits['vacation'], 3));
     $pdf->SetX(54);
     //$pdf->Write(0, $sbalance);
     $pdf->Write(0, number_format($credits['sick'], 3));
     $total_leave_balance = $credits['vacation'] + $credits['sick'];
     $pdf->SetX(80);
     $pdf->Write(0, number_format($total_leave_balance, 3));
     // set font, font style, font size.
     $pdf->SetFont('Arial', 'B', 12);
     $pdf->Ln(9);
     $pdf->SetX(136);
     //credits
     //vaation
     $pdf->Ln(23);
     $pdf->SetX(52);
     //$pdf->Write(0, number_format($vacation_leave, 3));
     //sick
开发者ID:billyriantono,项目名称:ihrmis,代码行数:67,代码来源:reports.php

示例3: deactivateAbandonedLenders

 public function deactivateAbandonedLenders()
 {
     $thirteenMonthsAgo = new Carbon();
     $thirteenMonthsAgo->subMonths(13);
     $oneMonthAgo = new Carbon();
     $oneMonthAgo->subMonth();
     $lenders = LenderQuery::create()->useUserQuery()->filterAbandoned($thirteenMonthsAgo)->useNotificationQuery()->filterByType("abandoned")->filterByCreatedAt(['max' => $oneMonthAgo])->endUse()->endUse()->find();
     foreach ($lenders as $lender) {
         $this->deactivateLender($lender);
     }
 }
开发者ID:Junyue,项目名称:zidisha2,代码行数:11,代码来源:LenderService.php

示例4: refactorRolledOverDate

 /**
  * Adjusts a date that has rolled over back to the previous month; setting the day
  * to the last day of the previous month; time values are maintained.
  *
  * @param Carbon $date
  * @param Carbon $original_date
  *
  * @return \DateTime
  */
 protected function refactorRolledOverDate(Carbon $date, Carbon $original_date)
 {
     return $date->subMonth()->endOfMonth()->setTime($original_date->hour, $original_date->minute, $original_date->second);
 }
开发者ID:20TRIES,项目名称:date_range,代码行数:13,代码来源:DateRange.php

示例5: getOrderedBalancesByDate

 public function getOrderedBalancesByDate(Account $acc, Carbon $date)
 {
     $end = $date->copy();
     $start = $date->subMonth();
     return $this->createQueryBuilder('ab')->leftJoin('ab.account', 'acc')->where('acc = :account')->andWhere('ab.created_at >= :start')->andWhere('ab.created_at <= :end')->addOrderBy('ab.created_at', 'ASC')->setParameters(['account' => $acc, 'start' => $start, 'end' => $end])->getQuery()->getResult();
 }
开发者ID:Remnant-Legion,项目名称:eau,代码行数:6,代码来源:AccountBalanceRepository.php

示例6: foreach

$e = new Employee_m();
if (!empty($rows)) {
    foreach ($rows as $row) {
        $id = $row['id'];
        $employee_id = $row['employee_id'];
        $lgu_code = Setting::getField('lgu_code');
        $dt = new Carbon();
        // Quezon Province
        if ($lgu_code == 'quezon_province') {
            $last_earn = $this->Leave_card->get_last_earn($rows['employee_id']);
            if ($last_earn != '') {
                $record_limit_date = $last_earn;
                $last_earn = date('F d, Y', strtotime($last_earn));
            } else {
                $dt = new Carbon();
                $dt->subMonth();
                $date = new Carbon('last day of ' . $this->Helps->get_month_name($dt->month) . ' ' . $dt->year);
                $last_earn = $this->Helps->get_month_name($date->month) . ' ' . $date->day . ', ' . $date->year;
                $record_limit_date = $date->year . '-' . $date->month . '-' . $date->day;
                $total_leave = $this->Leave_card->get_total_leave_credits($employee_id, $record_limit_date);
            }
            //$this->leave_certification_marinduque($vl, $sl, $employee_id);
            //return;
        } else {
            // total leave
            $total_leave = $this->Leave_card->get_total_leave_credits($employee_id);
        }
        $office_name = $this->Office->get_office_name($row['office_id']);
        $bg = $this->Helps->set_line_colors();
        ?>
  <tr bgcolor="<?php 
开发者ID:billyriantono,项目名称:ihrmis,代码行数:31,代码来源:records.php


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