public static function getSecondsBetweenDates(\DateTime $dateA, \DateTime $dateB)
    {
        $diff = $dateA->diff($dateB);

        $sec = $diff->s;
        //add minutes
        $sec += $diff->i * 60;
        //add hours
        $sec += $diff->h * 3600;
        //add days
        $sec += $diff->days * 86400;

        return $sec;
    }
public static function getSecondsBetweenDates(\DateTime $dateA, \DateTime $dateB)
    {
        $diff = $dateA->diff($dateB);

        $sec = $diff->s;
        //add minutes
        $sec += $diff->i * 60;
        //add hours
        $sec += $diff->h * 3600;
        //add days
        $sec += $diff->days * 86400;

        return $sec;
    }
public static function getSecondsBetweenDates ( \ DateTime $ dateA , \ DateTime $ dateB ) { $ diff = $ dateA -> diff ( $ dateB ) ; $ sec = $ diff -> s ; //add minutes $ sec += $ diff -> i * 60 ; //add hours $ sec += $ diff -> h * 3600 ; //add days $ sec += $ diff -> days * 86400 ; return $ sec ; }
Calculates the seconds between two dates.

@param \DateTime $dateA
@param \DateTime $dateB

@return mixed
Calculates the seconds between two dates .