Why is the sitemap validator returning an error for the "lastmod" tag?

Per the schema, tLastMod is the union of xsd:date and xsd:dateTime.

Since you provide hours, you are not in the first case, so your string should conform to the XSD dateTime type, and it does not: you need to specify the part with seconds.

See https://www.w3.org/TR/2012/REC-xmlschema11-2-20120405/#dateTime-lexical-mapping for the full format.

So, if you try with 2017-07-24T04:37:00Z the validation error on this element should go away.


The tool http://tools.seochat.com/tools/site-validator/ gives no error when also specifying the seconds:

<lastmod>2017-07-24T04:37:00Z</lastmod>

Are the seconds required for a datetime? There is a conflict in the spec vs. the schema:

  • According to the spec for lastmod, specifying the seconds isn’t required for datetimes. The lastmod element uses the "W3C Datetime format", according to which your datetime is valid.

  • According to the XML schema, specifying the seconds is required for datetimes (as Patrick Mevzek’s answer points out).


Make sure none of your values are blank. I troubleshooted this for a while and realized my "last edit date" field for certain entries was blank and thus it was causing markup errors in the XML file due to nothing populating for certain URLs