@Override
    public void filter(Metadata metadata) throws TikaException {
        SimpleDateFormat dateFormatter = null;
        SimpleDateFormat utcFormatter = null;
        for (String n : metadata.names()) {

            Property property = Property.get(n);
            if (property != null) {
                if (property.getValueType().equals(Property.ValueType.DATE)) {
                    String dateString = metadata.get(property);
                    if (dateString.endsWith("Z")) {
                        continue;
                    }
                    if (dateFormatter == null) {
                        dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.US);
                        dateFormatter.setTimeZone(defaultTimeZone);
                        utcFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.US);
                        utcFormatter.setTimeZone(UTC);
                    }
                    Date d = null;
                    try {
                        d = dateFormatter.parse(dateString);
                        metadata.set(property, utcFormatter.format(d));
                    } catch (ParseException e) {
                        LOGGER.warn("Couldn't convert date to default time zone: >"
                                + dateString + "<");
                    }
                }
            }
        }
    }
Some dates in some file formats do not have a timezone.
Tika correctly stores these without a timezone, e.g. 'yyyy-MM-dd'T'HH:mm:ss'
This can be a problem if end points expect a 'Z' timezone.
This filter makes the assumption that dates without timezones are UTC
and always modifies the date to: "yyyy-MM-dd'T'HH:mm:ss'Z'"

Users can specify an alternate defaultTimeZone with
{@link DateNormalizingMetadataFilter#setDefaultTimeZone(String)} to apply
if the file format does not specify a timezone.
tika-core/src/main/java/org/apache/tika/metadata/filter/DateNormalizingMetadataFilter.java