RSS feed date formatting

Discussion in 'C#' started by flagday, Jun 29, 2007.

  1. #1
    Sorry, don't know a lick of ASP, but one of my clients requires it to read a simple Wordpress RSS feed, so I found this, which works great.

    Problem is, it's publishing the date and time with "+0000" and all I really want is the date as in June 29, 2007.

    I have isolated the code to the point where this is determined:
    This displays the correct date and time for each post in the folloing format:
    Thu, 28 Jun 2007 18:56:57 +0000

    Now, if I change just that last line to:
    The format is correct, but it shows today's date:
    Friday, June 29, 2007

    Right format, wrong date; wrong format, right date.

    I have a feeling all I need to do is change the word date in that "FormatDateTime(date, 1)" line, but I'm at a loss.

    Any ideas?
     
    flagday, Jun 29, 2007 IP
  2. ludwig

    ludwig Notable Member

    Messages:
    2,253
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    225
    #2
    dude :) in your code you want it to show that format, so it shows that formay, and you want it to show today's date and it shows today's date
    FormatDateTime(date, 1)

    here is how I have done it
    you need to do something like this, it is more easier than converting a string to datetime value
     
    ludwig, Jun 29, 2007 IP
  3. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #3
    I believe their is a date.tryparse so you could do

    dim DateStr as datetime
    if date.tryparse(YourDate,DateStr) then
    ' I Gotz a valid date and already declared as DateStr.
    end if
     
    ccoonen, Jul 6, 2007 IP