Turn on thread page Beta
    • Thread Starter
    Offline

    0
    ReputationRep:
    Ok this is a very easy problem, normaly I would work this out for myself but am mad busy, and its not in any of my books I've looked in.

    In ASP (vb code may work) how do you put todays date into a variable so I can stick in a database? this is very easy to with PHP but no so in ASP so it seems.

    Thanks. I'll rep the first solution that works tomororow.
    Offline

    0
    ReputationRep:
    (Original post by amazingtrade)
    Ok this is a very easy problem, normaly I would work this out for myself but am mad busy, and its not in any of my books I've looked in.

    In ASP (vb code may work) how do you put todays date into a variable so I can stick in a database? this is very easy to with PHP but no so in ASP so it seems.

    Thanks. I'll rep the first solution that works tomororow.

    html>
    <body>

    Today's date is: <%response.write(date())%>.
    <br>
    The server's local time is: <%response.write(time())%>.

    </body>
    </html>
    • Thread Starter
    Offline

    0
    ReputationRep:
    Yeah thanks, the problem is that only outputs it to the screen, I need to actually store the date into a variable.

    I will try todaydate=(date()) in the hope it will work but I doubt it. I had trouble with this last time i tired it in December.
    Offline

    2
    ReputationRep:
    (Original post by amazingtrade)
    Ok this is a very easy problem, normaly I would work this out for myself but am mad busy, and its not in any of my books I've looked in.

    In ASP (vb code may work) how do you put todays date into a variable so I can stick in a database? this is very easy to with PHP but no so in ASP so it seems.

    Thanks. I'll rep the first solution that works tomororow.
    hey! that rep was promised to me

    only joking, don't bother, i've had quite alot over the last few days and i'm very happy with my current 96 points
    Offline

    0
    ReputationRep:
    (Original post by amazingtrade)
    Yeah thanks, the problem is that only outputs it to the screen, I need to actually store the date into a variable.

    I will try todaydate=(date()) in the hope it will work but I doubt it. I had trouble with this last time i tired it in December.
    oh i did this for my AS project hold on lemme just find it
    Offline

    0
    ReputationRep:
    (Original post by amazingtrade)
    Yeah thanks, the problem is that only outputs it to the screen, I need to actually store the date into a variable.

    I will try todaydate=(date()) in the hope it will work but I doubt it. I had trouble with this last time i tired it in December.

    %
    on error resume next
    set conn=Server.CreateObject("ADODB. Connection")
    conn.provider="Microsoft.Jet.OLE DB.4.0"
    conn.open(server.mappath("databa se.mdb"))

    name=Request.Form("name")
    email=Request.Form("email")

    sql="INSERT INTO tblGuestBook (name,email,dateadded) VALUES "
    sql=sql & "('" & name & "','" & email & "','" & now() & "')"



    conn.Execute sql,recordsaffected
    if err <> 0 then
    Response.Write("You do not have permission to update this database!")
    else
    Response.Write(Recordsaffected & " record added")
    end if
    conn.close
    %>
    • Thread Starter
    Offline

    0
    ReputationRep:
    Thanks so its this that inserts the date?

    now()
    Offline

    0
    ReputationRep:
    i have not touched ASP in time, but i think so, yes
    • Thread Starter
    Offline

    0
    ReputationRep:
    thanks now() works perfectly.
 
 
 
Poll
Which accompaniment is best?
Useful resources

The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

Write a reply...
Reply
Hide
Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.