protected function getDateTime($dateTime)
    {
        if ($dateTime instanceof \DateTime) {
            return $dateTime;
        }

        if ((is_string($dateTime) && (int) $dateTime > 0) || is_numeric($dateTime)) {
            return (new \DateTime())->setTimestamp($dateTime);

        }

        throw new \common_Exception(__('A date has to be a Datetime or timestamp'));
    }
protected function getDateTime($dateTime)
    {
        if ($dateTime instanceof \DateTime) {
            return $dateTime;
        }

        if ((is_string($dateTime) && (int) $dateTime > 0) || is_numeric($dateTime)) {
            return (new \DateTime())->setTimestamp($dateTime);

        }

        throw new \common_Exception(__('A date has to be a Datetime or timestamp'));
    }
protected function getDateTime ( $ dateTime ) { if ( $ dateTime instanceof \ DateTime ) { return $ dateTime ; } if ( ( is_string ( $ dateTime ) && ( int ) $ dateTime > 0 ) || is_numeric ( $ dateTime ) ) { return ( new \ DateTime ( ) ) -> setTimestamp ( $ dateTime ) ; } throw new \ common_Exception ( __ ( 'A date has to be a Datetime or timestamp' ) ) ; }
Transform a string|Datetime to Datetime

@param $dateTime
@return \DateTime
@throws \common_Exception
Transform a string|Datetime to Datetime