This is what you can do if you submitted a sitemap to Google, and everything appears to be valid, but you still get the invalid date in lastmod error.
This problem is usually coursed by an invalid date, either due to a invalid or missing time stamp in the database, or due to a problem with the code that generates the sitemap.
Debugging invalid date
What you can do:
- If possible, look up the line number.
- Make sure that a valid date format is used.
You can easily output a valid date with the PHP date function, the following examples will both work. The first is the YYYY-mm-dd format, which doesn't include the hour and minute, the latter will generate a ISO 8601 date.
$formatted_date = date('Y-m-d', $row['last_updated']); // YYYY-mm-dd $formatted_date = date('c', $row['last_updated']); // ISO 8601 (added in PHP 5)
The ISO 8601 date will look like the below: