0
저는 강력한 ASP 클래식 개발자는 아니지만 직장에서이 응용 프로그램을 지원하도록 임무를 부여 받았습니다. 짧은 날짜 형식의 RSS 피드 날짜입니다. 그리고 나는 해결책을 찾지 못하는 것 같습니다.ASP-Classic의 짧은 날짜 (MM/DD/YYYY)에 대한 RFC-32 날짜 형식
나는이 형식이 :
Wed, 10 Jun 2009 12:46:13 +0000
을하고 나는이 형식으로 그것을 얻을해야합니다
06/10/2009
지금까지 내가 ASP이 RSS 피드 스크립트 땜질되었습니다
<%
' change the RSSURL variable to the exact URL of the RSS Feed you want to pull
RSSURL = "{url to rss feed}"
Dim objHTTP ' this object is used to call the RSS Feed remotely
Dim RSSURL,RSSFeed ' these variables hold the URL and Content for the RSS Feed
Dim xmlRSSFeed ' this variable hold the XML data in a DOM Object
Dim objItems,objItem, objChild ' these variables are used to temporarily hold data from the various RSS Items
Dim title,description,link ' these are local variables that will hold the data to be displayed
Dim pubDate
Dim RSSOutput ' variable will hold the HTML that was converted from the RSS Feed
' this code requests the raw RSS/XML and saves the response as a string <RSSFeed>
Set objHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP")
objHTTP.open "GET",RSSURL,false
objHTTP.send
RSSFeed = objHTTP.responseText
' this code takes the raw RSSFeed and loads it into an XML Object
Set xmlRSSFeed = Server.CreateObject("MSXML2.DomDocument.4.0")
xmlRSSFeed.async = false
xmlRSSFeed.LoadXml(RSSFeed)
' this code disposes of the object we called the feed with
Set objHTTP = Nothing
' this is where you determine how to display the content from the RSS Feed
' this code grabs all the "items" in the RSS Feed
Set objItems = xmlRSSFeed.getElementsByTagName("item")
' this code disposes of the XML object that contained the entire feed
Set xmlRSSFeed = Nothing
' loop over all the items in the RSS Feed
For x = 0 to 3
' this code places the content from the various RSS nodes into local variables
Set objItem = objItems.item(x)
For Each objChild in objItem.childNodes
Select Case LCase(objChild.nodeName)
Case "title"
title = objChild.text
Case "link"
link = objChild.text
Case "description"
description = objChild.text
Case "pubdate"
pubDate = objChild.text
End Select
Next
' Format display output
RSSOutput = RSSOutput & "<tr><td valign='top' style='width:75px; height: 34px;' class='addresstext2'><b>"& pubDate &"</b></td><td valign='top'><a class=ccc href=""" & link & """>" & title & "</a></td></tr>"
Next
%>
RSS에서 pubDate를 얻으면 문자열이라고 생각합니다. CDate하려고하면 형식 불일치가 발생하며 Format() 및 동일한 거래도 시도했습니다. 누구든지이 날짜를 원하는 형식으로 포맷하는 방법을 제안 할 수 있습니까?
감사합니다.
최고, 그거 빨리! 고맙습니다. 내가 거기 놓친 것을 믿을 수 없어, Google을 통해 RSSDate 형식 등의 결과를 찾을 수 없습니다. – Jakub
문제 없습니다. 나는 rss 날짜 형식이 RFC822임을 알았으므로 vbscript 및/또는 asp 구문 분석과 함께 검색했습니다. – Espo