Help Parsing RFC822 Formatted Date

Discussion in 'ASP General' started by VUNETdotUS, Oct 17, 2007.

  1. VUNETdotUS

    VUNETdotUS Guest

    How can I parse RFC822 date format Sat, 13 Oct 2007 22:09:03 PDT to MM/
    DD/YYYY?
    Any reference you can recommend?
    Thanks
    VUNETdotUS, Oct 17, 2007
    #1
    1. Advertising

  2. "VUNETdotUS" wrote:
    > How can I parse RFC822 date format Sat, 13 Oct 2007 22:09:03 PDT to
    > MM/DD/YYYY?


    This is not really an ASP question, but here's a JScript answer:

    Date.prototype.toMDCY = function() { ...insert code for
    formatting... }**
    return new Date("Sat, 13 Oct 2007 22:09:03 PDT").toMDCY()

    http://msdn2.microsoft.com/en-us/library/cd9w2te4.aspx

    Of course, this is time-zone dependent. On my system, this becomes
    10/14/2007.

    If you can stuff it in a SQL date variable, MSSQL has DATETIME styles for
    converting to character data:

    CONVERT(VARCHAR(10), @YourDateVariableHere, 101)
    http://msdn2.microsoft.com/en-us/library/ms187928.aspx

    I really couldn't say what VBScript would require.



    **For example, assume you have already dealt with Number.prototype.pad...

    Date.prototype.toMDCY = function() {
    return (this.getMonth()+1).pad(2) + "/" + this.getDate().pad(2) +
    "/" + this.getFullYear()
    }


    --
    Dave Anderson

    Unsolicited commercial email will be read at a cost of $500 per message. Use
    of this email address implies consent to these terms.
    Dave Anderson, Oct 17, 2007
    #2
    1. Advertising

  3. VUNETdotUS

    VUNETdotUS Guest

    On Oct 16, 10:57 pm, VUNETdotUS <> wrote:
    > How can I parse RFC822 date format Sat, 13 Oct 2007 22:09:03 PDT to MM/
    > DD/YYYY?
    > Any reference you can recommend?
    > Thanks


    What I mean is there an easier way to parse other than splitting by
    space, converting Oct to 10, etc.
    Thanks
    VUNETdotUS, Oct 17, 2007
    #3
  4. VUNETdotUS

    VUNETdotUS Guest

    On Oct 17, 1:51 pm, "Dave Anderson" <>
    wrote:
    > "VUNETdotUS" wrote:
    > > How can I parse RFC822 date format Sat, 13 Oct 2007 22:09:03 PDT to
    > > MM/DD/YYYY?

    >
    > This is not really an ASP question, but here's a JScript answer:
    >
    > Date.prototype.toMDCY = function() { ...insert code for
    > formatting... }**
    > return new Date("Sat, 13 Oct 2007 22:09:03 PDT").toMDCY()
    >
    > http://msdn2.microsoft.com/en-us/library/cd9w2te4.aspx
    >
    > Of course, this is time-zone dependent. On my system, this becomes
    > 10/14/2007.
    >
    > If you can stuff it in a SQL date variable, MSSQL has DATETIME styles for
    > converting to character data:
    >
    > CONVERT(VARCHAR(10), @YourDateVariableHere, 101)
    > http://msdn2.microsoft.com/en-us/library/ms187928.aspx
    >
    > I really couldn't say what VBScript would require.
    >
    > **For example, assume you have already dealt with Number.prototype.pad...
    >
    > Date.prototype.toMDCY = function() {
    > return (this.getMonth()+1).pad(2) + "/" + this.getDate().pad(2) +
    > "/" + this.getFullYear()
    > }
    >
    > --
    > Dave Anderson
    >
    > Unsolicited commercial email will be read at a cost of $500 per message. Use
    > of this email address implies consent to these terms.


    thanks Dave
    VUNETdotUS, Oct 18, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vladimir Litovka

    rfc822 regexp

    Vladimir Litovka, Feb 4, 2004, in forum: Perl
    Replies:
    1
    Views:
    780
  2. Darren Davison

    Dates from Strings in RFC822 format

    Darren Davison, Jul 23, 2003, in forum: Java
    Replies:
    2
    Views:
    1,515
    Shripathi Kamath
    Jul 23, 2003
  3. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,197
    Michael Borgwardt
    May 30, 2004
  4. Michael B Allen

    rfc822.py date parsing problem

    Michael B Allen, Jan 17, 2004, in forum: Python
    Replies:
    0
    Views:
    298
    Michael B Allen
    Jan 17, 2004
  5. JDP@Work

    Help: Sort Date dg col , Add formatted field to a ds?

    JDP@Work, Feb 19, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    105
    JDP@Work
    Feb 19, 2005
Loading...

Share This Page