public function CircleCiManager::formatCircleCiDateTime in Build Hooks 3.x
Same name and namespace in other branches
- 8.2 modules/build_hooks_circleci/src/CircleCiManager.php \Drupal\build_hooks_circleci\CircleCiManager::formatCircleCiDateTime()
Converts the datetime format into a drupal formatted date.
Parameters
string $datetime: Date in the format returned by the CircleCi api.
Return value
string Drupal formatted date.
Overrides CircleCiManagerInterface::formatCircleCiDateTime
File
- modules/
build_hooks_circleci/ src/ CircleCiManager.php, line 153
Class
- CircleCiManager
- Defines a service for managing Circle CI deployments.
Namespace
Drupal\build_hooks_circleciCode
public function formatCircleCiDateTime($datetime) {
// Dates are in UTC format:
$timezone = new \DateTimeZone('UTC');
$date = \DateTime::createFromFormat(self::CIRCLE_CI_DATE_FORMAT, $datetime, $timezone);
return $this->dateFormatter
->format($date
->getTimestamp(), 'long');
}