Page is a not externally linkable
gdwebdesign - 1:29 pm on Jul 9, 2008 (gmt 0)
My code is below: Thanks Graeme <?xml version="1.0" encoding="ISO-8859-1"?> Dim Connection Function ApplyXMLFormatting(strInput) ApplyXMLFormatting = strInput Function FormatDateInXMLStyle(datDate) 'e.g. Sat, 07 Sep 2002 09:42:31 GMT SQL = "SELECT DISTINCT DocID, DocTitle, HTMLfile, PDFfile, DatePublished, Orderable, BriefDescription FROM vwSearch where SectionID=11 ORDER BY DatePublished DESC" Set Connection = Server.CreateObject("ADODB.Connection") Connection.Open "provider=sqloledb;data source=www_alias;initial catalog=company;Integrated Security=SSPI" Recordset.Open SQL,Connection If Recordset.EOF Then Do While NOT Recordset.Eof [edited by: bill at 1:00 am (utc) on July 10, 2008]
I am using ASP to create an RSS feed from a database. I eventually managed to get the date to display by writing an ASP function that converted my date into a format that the XML could convert. My problem now is that the database does not hold the time and each date is displayed with 00:00:00. Is there any way I can remove the time from the RSS feed?
<rss version="2.0">
<channel>
<title>News</title>
<link>http://www.example.co.uk/news/</link>
<%
''Response.end
Response.Buffer = true
Response.ContentType = "text/xml"
Dim Recordset
Dim SQL
strInput = Replace(strInput,"&", "&")
strInput = Replace(strInput,"'", "'")
strInput = Replace(strInput,"""", """)
strInput = Replace(strInput, ">", ">")
strInput = Replace(strInput,"<","<")
End Function
FormatDateInXMLStyle = _
WeekdayName(Weekday(datDate), True) & ", " & _
Right("0" & Day(datDate), 2) & " " & _
MonthName(Month(datDate), True) & " " & _
Right("000" & Year(datDate), 4) '& " " & _
'Right("0" & Hour(datDate), 2) & ":" & _
'Right("0" & Minute(datDate), 2) & ":" & _
'Right("0" & Second(datDate), 2) & " GMT"
End Function
Set Recordset = Server.CreateObject("ADODB.Recordset")
Response.Write("No records returned.")
End If
%>
<item>
<title><%=ApplyXMLFormatting(Recordset("DocTitle"))%></title>
<%if Recordset("HTMLfile") <> "" then %>
<link>http://www.example.co.uk/news/files/<%=ApplyXMLFormatting(Recordset("HTMLfile"))%></link>
<%else%>
<link>http://www.example.co.uk/news/files/<%=ApplyXMLFormatting(Recordset("PDFfile"))%></link>
<%end if%>
<pubDate>
<%
=ApplyXMLFormatting(FormatDateInXMLStyle(Recordset("DatePublished")))
%>
</pubDate>
<description><%=ApplyXMLFormatting(Recordset("BriefDescription"))%></description></item><%
Recordset.MoveNext
Loop
Recordset.Close()
Set Recordset=nothing
Connection.Close
Set Connection=nothing
%></channel></rss>
[edit reason] Use example.com or example.co.uk for Examples [/edit]