You are here

public function Promotion::setStartDate in Commerce Core 8.2

Sets the promotion start date/time.

Parameters

\Drupal\Core\Datetime\DrupalDateTime $start_date: The promotion start date/time.

Return value

$this

Overrides PromotionInterface::setStartDate

File

modules/promotion/src/Entity/Promotion.php, line 430

Class

Promotion
Defines the promotion entity class.

Namespace

Drupal\commerce_promotion\Entity

Code

public function setStartDate(DrupalDateTime $start_date) {
  $this
    ->get('start_date')->value = $start_date
    ->format(DateTimeItemInterface::DATETIME_STORAGE_FORMAT);
  return $this;
}