Neos\Eel\Helper\DateHelper::second PHP Method

second() public method

Get the second of a date
public second ( DateTimeInterface $dateTime ) : integer
$dateTime DateTimeInterface
return integer The second of the given date
    public function second(\DateTimeInterface $dateTime)
    {
        return (int) $dateTime->format('s');
    }

Usage Example

 /**
  * @test
  */
 public function dateAccessorsWork()
 {
     $helper = new DateHelper();
     $date = new \DateTime('2013-10-16 14:59:27');
     $this->assertSame(2013, $helper->year($date));
     $this->assertSame(10, $helper->month($date));
     $this->assertSame(16, $helper->dayOfMonth($date));
     $this->assertSame(14, $helper->hour($date));
     $this->assertSame(59, $helper->minute($date));
     $this->assertSame(27, $helper->second($date));
 }