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