You are here

public function Carbon::average in Persian Date for Drupal 8 8.4

Modify the current instance to the average of a given instance (default now) and the current instance.

Parameters

\Drupal\persian_date\Library\Carbon\Carbon|null $dt:

Return value

static

File

src/Library/Carbon/Carbon.php, line 3301

Class

Carbon
A simple API extension for DateTime

Namespace

Drupal\persian_date\Library\Carbon

Code

public function average(Carbon $dt = null) {
  $dt = $dt ?: static::now($this
    ->getTimezone());
  return $this
    ->addSeconds((int) ($this
    ->diffInSeconds($dt, false) / 2));
}