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;
    }