ExpressiveDate::getDifferenceInHours PHP Method

getDifferenceInHours() public method

Get the difference in hours.
public getDifferenceInHours ( ExpressiveDate $compare = null ) : string
$compare ExpressiveDate
return string
    public function getDifferenceInHours($compare = null)
    {
        return $this->getDifferenceInMinutes($compare) / 60;
    }

Usage Example

Beispiel #1
0
 public function testGetDateDifferenceInHours()
 {
     $past = new ExpressiveDate('-10 hours');
     $future = new ExpressiveDate('+1 hour');
     $this->assertEquals(-11, $future->getDifferenceInHours($past));
     $this->assertEquals(11, $past->getDifferenceInHours($future));
 }