Datetime 使用ASP Classic将RFC-32日期格式转换为短日期(MM/DD/YYYY)

Datetime 使用ASP Classic将RFC-32日期格式转换为短日期(MM/DD/YYYY),datetime,asp-classic,rfc822,Datetime,Asp Classic,Rfc822,我不是一个优秀的ASP经典开发人员,但我的任务是在工作中支持这个应用程序,我一直在尝试将RSS提要日期转换为短日期格式。我似乎找不到解决办法 我有以下格式: Wed, 10 Jun 2009 12:46:13 +0000 06/10/2009 我需要把它转换成这样的格式: Wed, 10 Jun 2009 12:46:13 +0000 06/10/2009 到目前为止,我一直在修补ASP的RSS提要脚本: <% ' change the RSSURL variable to the

我不是一个优秀的ASP经典开发人员,但我的任务是在工作中支持这个应用程序,我一直在尝试将RSS提要日期转换为短日期格式。我似乎找不到解决办法

我有以下格式:

Wed, 10 Jun 2009 12:46:13 +0000
06/10/2009
我需要把它转换成这样的格式:

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()和相同的处理。有人能建议一种方法来格式化这个日期,以满足我的需要吗


谢谢

Rss使用中指定的格式

我在以下内容中找到了一个函数:

它还调用一个名为monthVal的函数,该函数只返回月份名称的数字:

代码:


太棒了,太快了!谢谢,我不敢相信我错过了,我无法通过谷歌找到任何RSSDate格式的结果。没问题。我知道rss日期格式是RFC822,所以我结合vbscript和/或asp解析搜索它。