Example #1
0
 /**
  * Format date.
  *
  * @param string $format Format accepted by date(). When empty it's using the default format.
  *
  * @return string
  */
 public function format($format = '')
 {
     if ($this->isHollow()) {
         $format = $this->format;
     } else {
         $format = $format ?: $this->format;
     }
     return parent::format($format);
 }
Example #2
0
 /**
  * @covers ::format
  */
 public function test_format_custom_format()
 {
     // When
     $dt = new DateTime('1956-11-12');
     // Then
     $this->assertSame('1956:11:12', $dt->format('Y:m:d'));
 }