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/
    Any reference you can recommend?
    VUNETdotUS, Oct 17, 2007
    1. Advertisements

  2. 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()

    Of course, this is time-zone dependent. On my system, this becomes

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

    CONVERT(VARCHAR(10), @YourDateVariableHere, 101)

    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, Oct 17, 2007
    1. Advertisements

  3. VUNETdotUS

    VUNETdotUS Guest

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

    VUNETdotUS Guest

    thanks Dave
    VUNETdotUS, Oct 18, 2007
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.