protected static function parseDateValue($value, $format, $timeZone)
    {
        $date = DateTime::createFromFormat($format, $value, new DateTimeZone($timeZone));
        $errors = DateTime::getLastErrors();
        if ($date === false || $errors['error_count'] || $errors['warning_count']) {
            return false;
        } else {
            // if no time was provided in the format string set time to 0 to get a simple date timestamp
            if (strpbrk($format, 'UHhGgis') === false) {
                $date->setTime(0, 0, 0);
            }
            return $date;
        }
    }
protected static function parseDateValue($value, $format, $timeZone)
    {
        $date = DateTime::createFromFormat($format, $value, new DateTimeZone($timeZone));
        $errors = DateTime::getLastErrors();
        if ($date === false || $errors['error_count'] || $errors['warning_count']) {
            return false;
        } else {
            // if no time was provided in the format string set time to 0 to get a simple date timestamp
            if (strpbrk($format, 'UHhGgis') === false) {
                $date->setTime(0, 0, 0);
            }
            return $date;
        }
    }
protected static function parseDateValue ( $ value , $ format , $ timeZone ) { $ date = DateTime :: createFromFormat ( $ format , $ value , new DateTimeZone ( $ timeZone ) ) ; $ errors = DateTime :: getLastErrors ( ) ; if ( $ date === false || $ errors [ 'error_count' ] || $ errors [ 'warning_count' ] ) { return false ; } else { // if no time was provided in the format string set time to 0 to get a simple date timestamp if ( strpbrk ( $ format , 'UHhGgis' ) === false ) { $ date -> setTime ( 0 , 0 , 0 ) ; } return $ date ; } }
Parses date string into DateTime object

@param string $value string representing date
@param string $format string representing date
@param string $timeZone string representing date
@return boolean|DateTime DateTime object or false on failure
Parses date string into DateTime object