You are here

protected function DateTimeComparator::dateTimeToString in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/sebastian/comparator/src/DateTimeComparator.php \SebastianBergmann\Comparator\DateTimeComparator::dateTimeToString()

Returns an ISO 8601 formatted string representation of a datetime or 'Invalid DateTimeInterface object' if the provided DateTimeInterface was not properly initialized.

Parameters

\DateTimeInterface $datetime:

Return value

string

1 call to DateTimeComparator::dateTimeToString()
DateTimeComparator::assertEquals in vendor/sebastian/comparator/src/DateTimeComparator.php
Asserts that two values are equal.

File

vendor/sebastian/comparator/src/DateTimeComparator.php, line 74

Class

DateTimeComparator
Compares DateTimeInterface instances for equality.

Namespace

SebastianBergmann\Comparator

Code

protected function dateTimeToString($datetime) {
  $string = $datetime
    ->format(\DateTime::ISO8601);
  return $string ? $string : 'Invalid DateTimeInterface object';
}