private function parse($date, $timezone = null)
    {
        if (!($date instanceof \DateTime)) {
            if (false === strtotime($date)) {
                throw new \Exception('Invalid date not parsed.');
            }

            if (!$timezone) {
                $timezone = $this->timezoneSource;
            }

            $date = new \DateTime($date, new \DateTimeZone($timezone));
        }

        return $date;
    }
private function parse($date, $timezone = null)
    {
        if (!($date instanceof \DateTime)) {
            if (false === strtotime($date)) {
                throw new \Exception('Invalid date not parsed.');
            }

            if (!$timezone) {
                $timezone = $this->timezoneSource;
            }

            $date = new \DateTime($date, new \DateTimeZone($timezone));
        }

        return $date;
    }
private function parse ( $ date , $ timezone = null ) { if ( ! ( $ date instanceof \ DateTime ) ) { if ( false === strtotime ( $ date ) ) { throw new \ Exception ( 'Invalid date not parsed.' ) ; } if ( ! $ timezone ) { $ timezone = $ this -> timezoneSource ; } $ date = new \ DateTime ( $ date , new \ DateTimeZone ( $ timezone ) ) ; } return $ date ; }
Parse a string into a DateTime.

@param string $date
@param string $timezone

@return \DateTime

@throws \Exception
Parse a string into a DateTime .