You are here

public function PersianDrupalDateTime::format in Persian Date for Drupal 8 8

Same name and namespace in other branches
  1. 8.4 src/Plugin/Datetime/PersianDrupalDateTime.php \Drupal\persian_date\Plugin\Datetime\PersianDrupalDateTime::format()

Overrides format().

Parameters

string $format: A format string using either PHP's date().

array $settings:

  • timezone: (optional) String timezone name. Defaults to the timezone of the date object.
  • langcode: (optional) String two letter language code used to control the result of the format() method. Defaults to NULL.

Return value

string The formatted value of the date. Since the format may contain user input, this value should be escaped when output.

Overrides DrupalDateTime::format

File

src/Plugin/Datetime/PersianDrupalDateTime.php, line 18

Class

PersianDrupalDateTime

Namespace

Drupal\persian_date\Plugin\Datetime

Code

public function format($format, $settings = []) {
  $dateTime = PersianDateFactory::buildFromOriginalDateTime($this->dateTimeObject);
  return $dateTime
    ->format($format);
}