This discussion is closed.
AT82
Badges: 0
Rep:
?
#1
Report Thread starter 17 years ago
#1
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.
0
Asha
Badges: 0
Rep:
?
#2
Report 17 years ago
#2
(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>
0
AT82
Badges: 0
Rep:
?
#3
Report Thread starter 17 years ago
#3
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.
0
iiikewldude
Badges: 2
Rep:
?
#4
Report 17 years ago
#4
(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
0
Asha
Badges: 0
Rep:
?
#5
Report 17 years ago
#5
(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
0
Asha
Badges: 0
Rep:
?
#6
Report 17 years ago
#6
(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.OLEDB.4.0"
conn.open(server.mappath("database.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
%>
0
AT82
Badges: 0
Rep:
?
#7
Report Thread starter 17 years ago
#7
Thanks so its this that inserts the date?

now()
0
Asha
Badges: 0
Rep:
?
#8
Report 17 years ago
#8
i have not touched ASP in time, but i think so, yes
0
AT82
Badges: 0
Rep:
?
#9
Report Thread starter 17 years ago
#9
thanks now() works perfectly.
0
X
new posts
Back
to top
Latest
My Feed

See more of what you like on
The Student Room

You can personalise what you see on TSR. Tell us a little about yourself to get started.

Personalise

Do you think mandatory Relationships and Sex Education in secondary schools is a good idea?

Yes (299)
84.23%
No (56)
15.77%

Watched Threads

View All