Reputation: 16803
When validating my XML sitemap, google says:
Invalid date An invalid date was found. Please fix the date or formatting before resubmitting.
I convert the mysql timestamp by:
gmdate('Y-m-d\TH:i:s', strtotime($row['modified']['value']))
Upvotes: 5
Views: 10807
Reputation: 5844
You could also use the DATE_W3C
date format constant, which matches the required format:
gmdate(DATE_W3C, strtotime($row['modified']['value']));
Upvotes: 1
Reputation: 3047
The 'lastmod' element has to be of the format YYYY-MM-DD
or YYYY-MM-DDThh:mmTZD
so use:
gmdate('Y-m-d', strtotime($row['modified']['value']))
or
gmdate('Y-m-d\TH:i:s+00:00', strtotime($row['modified']['value']))
Upvotes: 14