本文整理汇总了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;
}
示例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
示例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);
}
}
示例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);
}
示例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();
}
示例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