You are here

public function PriceList::getStartDate in Commerce Pricelist 8.2

Same name and namespace in other branches
  1. 8 src/Entity/PriceList.php \Drupal\commerce_pricelist\Entity\PriceList::getStartDate()

Gets the start date/time.

The start date/time should always be used in the store timezone. Since the price list can belong to multiple stores, the timezone isn't known at load/save time, and is provided by the caller instead.

Note that the returned date/time value is the same in any timezone, the "2019-10-17 10:00" stored value is returned as "2019-10-17 10:00 CET" for "Europe/Berlin" and "2019-10-17 10:00 ET" for "America/New_York".

Parameters

string $store_timezone: The store timezone. E.g. "Europe/Berlin".

Return value

\Drupal\Core\Datetime\DrupalDateTime The start date/time.

Overrides PriceListInterface::getStartDate

File

src/Entity/PriceList.php, line 205

Class

PriceList
Defines the Price list entity.

Namespace

Drupal\commerce_pricelist\Entity

Code

public function getStartDate($store_timezone = 'UTC') {
  return new DrupalDateTime($this
    ->get('start_date')->value, $store_timezone);
}