CFF KB - Carrz-Fox-Fire Promotions Knowledge Base
CFF KB is all about 1 thing: The Sharing of Knowledge and the Power we gain from it.Knowledge Base
- Breadrumbs:
Invalid date when submitting your sitemap to Google
- Article ID:
19 - Date Created
Thursday, September 30, 2010 - Last Updated
Wednesday, November 17, 2010 - This Article Has been Viewed
1695 times - Short Desc
Submitting a sitemap to google using the <lastmod> attibute you may get an Invalid date error if your format is not done correctly. - Details
To make a valid <lastmod> date and time format for your Google Map, it must have the following attributes
2010-09-30T10:20:58+00:00
(or)
2010-09-30 (This is just the date, without the time as shown above) - Recreate Issue
To recreate the issue, here are a few examples.
2010-09-30 10:20:58
2010-09-30 T10:20:58+00:00
2010-09-30 T 10:20:58 + 00:00
2010-09-30T 10:20:58 +00:00
2010-09-30T10:20:58+ 00:00 - Resolve Issue
To do this in ASP Classic, you will do the following.
<%
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 in your sitemap code
<%
<lastmod><%if not IsNull(rsgetCat("MDate")) then%><%=replace(rsgetCat("MDate")," ","")%>T<%=replace(rsgetCat("MilTime")," ","")&"+00:00"%><%else%><%=date()&"T"&time()&"+00:00"%><%end if%></lastmod>
%>
In the above, we are making sure that the field if NOT NULL, if it is not IsNULL then display the data and time, if it is Null, then dislap the current date and time in the correct format.
You want to make sure that there is not empty spaces in the data and time, so we use a replace() function to get rid of any and all spaces.
Share With Friends (Updated 6-8-2010)
Recent Articles
All Topics
- Coming Soon - Knowledge Exchange
Trending Articles
- Microsoft VBScript runtime error '800a0046' Permission denied FileSystemObject 24695
- Microsoft OLE DB Provider for SQL Server error '80040e57' String or binary data would be truncated. or The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data. 21297
- ADODB.Parameters error '800a0e7c' Parameter object is improperly defined 19545
- After Effects warning: Audio conforming failed for the following file .cfa. Perhaps due to disk space 17785
- The backup set holds a backup of a database other than the existing 16826