You are here

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

Get the difference in seconds

Parameters

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

bool $abs Get the absolute of the difference:

Return value

int

7 calls to Carbon::diffInSeconds()
Carbon::average in src/Library/Carbon/Carbon.php
Modify the current instance to the average of a given instance (default now) and the current instance.
Carbon::closest in src/Library/Carbon/Carbon.php
Get the closest date from the instance.
Carbon::diffInHours in src/Library/Carbon/Carbon.php
Get the difference in hours
Carbon::diffInMinutes in src/Library/Carbon/Carbon.php
Get the difference in minutes
Carbon::farthest in src/Library/Carbon/Carbon.php
Get the farthest date from the instance.

... See full list

File

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

Class

Carbon
A simple API extension for DateTime

Namespace

Drupal\persian_date\Library\Carbon

Code

public function diffInSeconds(Carbon $dt = null, $abs = true) {
  $dt = $dt ?: static::now($this
    ->getTimezone());
  $value = $dt
    ->getTimestamp() - $this
    ->getTimestamp();
  return $abs ? abs($value) : $value;
}