You are here

public function PeriodEntityTrait::getDuration in Recurring Time Period 8

Implements \Drupal\recurring_period\Entity\PeriodEntityInterface::getDuration().

File

src/Entity/PeriodEntityTrait.php, line 63

Class

PeriodEntityTrait
Provides base fields and accessors for entities that represent a time period.

Namespace

Drupal\recurring_period\Entity

Code

public function getDuration() {
  return $this
    ->getEndDate()
    ->format('U') - $this
    ->getStartDate()
    ->format('U');
}