What format should a sitemap lastmod date use?

By TechCompare · Updated · How we check

Write lastmod as YYYY-MM-DD, or add a time and zone like 2026-10-23T12:30:15+00:00. Google uses the value only when it's consistently and verifiably accurate.

The lastmod value in a sitemap is a W3C Datetime. The simplest valid form is a date, like 2026-10-23. You can add a time and a time zone after a capital T. Anything else, like 10/23/2026 or a date with a space before the time, is invalid, and the tester lists examples of the bad values it finds.

Topic
Sitemap lastmod format
Date format
Category
Sitemaps
Limits, dates and the Sitemap line

How it works

The sitemaps.org protocol asks for W3C Datetime and says you can leave out the time and use YYYY-MM-DD. The valid forms are a year (2026), a year and month (2026-10), a full date (2026-10-23), and a date with hours and minutes and a zone (2026-10-23T12:30Z), then with seconds, then with a fraction of a second. The zone is Z or an offset like +02:00. Once there's a time, the zone has to be there too. The tester checks the shape and also that the date exists, so a February 30 is invalid. It can't judge whether a date is true. Google says it uses lastmod when it's consistently and verifiably accurate, and that the value should reflect the last significant update to the page. Stamping every URL with the time of the last deploy tells it nothing about which pages changed. Google also says it ignores priority and changefreq.

Verdict

Fix invalid values first, since a parser may not understand them. Then ask whether each date means a real content change. Set lastmod from when a page's content last changed, not from when the sitemap was built, and leave it out where you can't tell. It's optional.

More Robots.txt scenarios

Block GPTBot
Two lines tell OpenAI's training crawler to stay out. Its search crawler and its page visits use other names.
View details
Google-Extended
A token for Gemini training, not a crawler. A rule for it never reaches Googlebot or Google Search.
View details
Block AI, keep search
Name each training crawler, leave Googlebot and Bingbot alone, and choose on purpose about the AI search bots.
View details

Frequently asked questions

Is lastmod required?
No. In the sitemaps protocol only the loc tag is required for a URL. lastmod is optional, and a missing value is better than a wrong one.
Does Google use priority and changefreq?
No. Google's documentation says it ignores both values.
Can I use a Unix timestamp or a slash date?
No. Neither is a W3C Datetime. Use YYYY-MM-DD at minimum, and add a T, the time and a zone if you want the time too.