KB Issue
Submitting a sitemap to Google using the attribute, you may get an Invalid date error if your format is not done correctly.
Issue Details
To make a valid <lastmod>
Copy
Search Site
Search Google
date and time format for your Google Map, it must have the following attributes
2010-09-30T10:20:58+00:00
Copy
Search Site
Search Google
or 2010-09-30
Copy
Search Site
Search Google
(This is just the date, without the time as shown above)
Recreate Issue
To recreate the issue, here are a few examples.
Resolve IssueTo do this in ASP Classic, you will do the following.
Code Example
Set getCat = CreateObject("ADODB.Command")
getCat.ActiveConnection=objConn
getCat.Prepared = true
getCat.commandtext="SELECT ID, convert(varchar(11),MDate,121) as MDate, CONVERT(CHAR(8), CONVERT(DATETIME, MDate, 113), 114) AS MilTime FROM MyTable"
set rsgetCat = getCat.execute
This is in your sitemap code
Code Example
<%if not IsNull(rsgetCat("MDate")) then%><%=replace(rsgetCat("MDate")," ","")%>T<%=replace(rsgetCat("MilTime")," ","")&"+00:00"%><%else%><%=date()&"T"&time()&"+00:00"%><%end if%>
In the above, we are ensuring that the field is NOT NULL
Copy
Search Site
Search Google
. If it is not IsNULL
Copy
Search Site
Search Google
, display the date and time; if it IsNULL
Copy
Search Site
Search Google
, display the current date and time in the correct format.
You want to make sure there are no empty spaces in the data or time, so we use the replace()
Copy
Search Site
Search Google
function to remove all spaces.