working with dates

Discussion in 'ASP General' started by Brett Atkin, Aug 18, 2003.

  1. Brett Atkin

    Brett Atkin Guest

    I have a form where I pass a member's end date to a processing page.

    The date is getting passed as a string so when I try to add to that date I
    get an error.

    Here is my code - the error message is below the code.

    ********************

    <%
    sub_amount = request("sub_amount")
    end_date = request("end_date")
    mem_email = request.form("mem_email")
    mem_first = request.form("mem_first")
    mem_last = request.form("mem_last")
    mem_ezine = request.form("mem_ezine")

    Select Case sub_amount

    Case "31.50"
    sub_term = "One Year"
    mem_status = "Current"
    start_date = end_date + 1
    end_date = start_date + 365

    Case "53.00"
    sub_term = "Two Years"
    mem_status = "Current"
    start_date = end_date + 1
    end_date = start_date + 730

    End Select
    %>

    ********************

    the error message.

    ********************
    Error Type:
    Microsoft VBScript runtime (0x800A000D)
    Type mismatch: '[string: "7/22/2003"]'
    /powerquotes_plus/Connections/subscriptions.asp, line 14
    ********************

    Question:

    How do I convert the string date (end_date) to a format that I can work
    with?

    Thanks

    Brett
     
    Brett Atkin, Aug 18, 2003
    #1
    1. Advertising

  2. Brett Atkin

    Brett Atkin Guest

    Bob,

    I knew that, I just couldn't it in my brain, I was drawing a blank. Thank
    you for the quick answer.

    It did help

    Brett


    "Bob Barrows" <> wrote in message
    news:...
    > Use CDate to convert the string to date.
    >
    > HTH,
    > Bob Barrows
    >
    > Brett Atkin wrote:
    > > I have a form where I pass a member's end date to a processing page.
    > >
    > > The date is getting passed as a string so when I try to add to that
    > > date I get an error.
    > >
    > > Here is my code - the error message is below the code.
    > >
    > > ********************
    > >
    > > <%
    > > sub_amount = request("sub_amount")
    > > end_date = request("end_date")
    > > mem_email = request.form("mem_email")
    > > mem_first = request.form("mem_first")
    > > mem_last = request.form("mem_last")
    > > mem_ezine = request.form("mem_ezine")
    > >
    > > Select Case sub_amount
    > >
    > > Case "31.50"
    > > sub_term = "One Year"
    > > mem_status = "Current"
    > > start_date = end_date + 1
    > > end_date = start_date + 365
    > >
    > > Case "53.00"
    > > sub_term = "Two Years"
    > > mem_status = "Current"
    > > start_date = end_date + 1
    > > end_date = start_date + 730
    > >
    > > End Select
    > > %>
    > >
    > > ********************
    > >
    > > the error message.
    > >
    > > ********************
    > > Error Type:
    > > Microsoft VBScript runtime (0x800A000D)
    > > Type mismatch: '[string: "7/22/2003"]'
    > > /powerquotes_plus/Connections/subscriptions.asp, line 14
    > > ********************
    > >
    > > Question:
    > >
    > > How do I convert the string date (end_date) to a format that I can
    > > work with?
    > >
    > > Thanks
    > >
    > > Brett

    >
    >
     
    Brett Atkin, Aug 18, 2003
    #2
    1. Advertising

  3. Brett Atkin

    Bob Barrows Guest

    Use CDate to convert the string to date.

    HTH,
    Bob Barrows

    Brett Atkin wrote:
    > I have a form where I pass a member's end date to a processing page.
    >
    > The date is getting passed as a string so when I try to add to that
    > date I get an error.
    >
    > Here is my code - the error message is below the code.
    >
    > ********************
    >
    > <%
    > sub_amount = request("sub_amount")
    > end_date = request("end_date")
    > mem_email = request.form("mem_email")
    > mem_first = request.form("mem_first")
    > mem_last = request.form("mem_last")
    > mem_ezine = request.form("mem_ezine")
    >
    > Select Case sub_amount
    >
    > Case "31.50"
    > sub_term = "One Year"
    > mem_status = "Current"
    > start_date = end_date + 1
    > end_date = start_date + 365
    >
    > Case "53.00"
    > sub_term = "Two Years"
    > mem_status = "Current"
    > start_date = end_date + 1
    > end_date = start_date + 730
    >
    > End Select
    > %>
    >
    > ********************
    >
    > the error message.
    >
    > ********************
    > Error Type:
    > Microsoft VBScript runtime (0x800A000D)
    > Type mismatch: '[string: "7/22/2003"]'
    > /powerquotes_plus/Connections/subscriptions.asp, line 14
    > ********************
    >
    > Question:
    >
    > How do I convert the string date (end_date) to a format that I can
    > work with?
    >
    > Thanks
    >
    > Brett
     
    Bob Barrows, Aug 18, 2003
    #3
    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. David Lozzi

    Dates dates dates dates... SQL and ASP.NET

    David Lozzi, Sep 29, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    894
    Rob Schieber
    Sep 30, 2005
  2. PW

    Dates! Dates! Dates!

    PW, Aug 7, 2004, in forum: ASP General
    Replies:
    4
    Views:
    223
    Mark Schupp
    Aug 9, 2004
  3. Replies:
    1
    Views:
    229
    Jano Svitok
    Jul 17, 2007
  4. kellygreer1

    RFC-822 dates into Ruby dates

    kellygreer1, Jun 8, 2008, in forum: Ruby
    Replies:
    1
    Views:
    230
    Eric I.
    Jun 8, 2008
  5. Dr J R Stockton

    FAQ Dates; Opera Dates.

    Dr J R Stockton, Jun 18, 2007, in forum: Javascript
    Replies:
    0
    Views:
    179
    Dr J R Stockton
    Jun 18, 2007
Loading...

Share This Page