Thanks for the feedback Kyle. I'll give it a shot.
Isn't there a way I can just insert the date into the query just using
the CURDATE value? And not have to make a function to convert the
format?
Thanks.
-----Original Message-----
From: Kyle Holder [mailto:kyle@stripped]
Sent: Thursday, July 03, 2003 7:02 AM
To: Ed Kraft; 'myodbc'
Subject: RE: Inserting Date Field
Hope this helps...
MySQL handles dates in a yyyy-mm-dd format, so...
<%
mydate = date()
thisday = day(mydate)
if thisday < 10 then
'dates less than 10 are formatted using one digit, but MySQL
requires 2, so we add a 0 to the beginning...
thisday = "0" & thisday
end if
thismonth = month(mydate)
if thismonth < 10 then
'Same thing with the month
thismonth = "0" & thismonth
end if
thisyear = year(mydate)
mydate = "'" & thisyear & "-" & thismonth & "-" & thisday & "'"
sql = "insert into table (thisdate) values (" & mydate & ")"
conn.execute sql
%>
Kyle Holder
-----Original Message-----
From: Ed Kraft [mailto:ekraft@stripped]
Sent: Thursday, July 03, 2003 11:52 AM
To: 'myodbc'
Subject: Inserting Date Field
Hey All,
How do I insert a date field into my mySQL db? I had it working with
Access (using the date()) function. Now after looking here:
http://www.mysql.com/doc/en/Date_and_time_functions.html
I see that it has to be done differently. I've tried using the CURDATE
function, but that doesn't do anything within my ASP pages.
Thanks,
Ed
--
MySQL ODBC Mailing List
For list archives: http://lists.mysql.com/myodbc
To unsubscribe:
http://lists.mysql.com/myodbc?unsub=1