You are here

public function BitbucketManager::formatBitbucketDateTime in Build Hooks 3.x

Converts the datetime format into a drupal formatted date.

Parameters

string $datetime: Date in the format returned by the Bitbucket api.

Return value

string Drupal formatted date.

File

modules/build_hooks_bitbucket/src/BitbucketManager.php, line 157

Class

BitbucketManager
Service for managing BitBucket connection details.

Namespace

Drupal\build_hooks_bitbucket

Code

public function formatBitbucketDateTime($datetime) {
  $timezone = new \DateTimeZone('UTC');
  $date = \DateTime::createFromFormat(self::BITBUCKET_DATE_FORMAT, $datetime, $timezone);
  return $this->dateFormatter
    ->format($date
    ->getTimestamp(), 'long');
}