List:MySQL ODBC« Previous MessageNext Message »
From:Daniel J. Summers Date:July 4 2003 11:52pm
Subject:Re: Inserting Date Field
View as plain text  

(Ed - I know I sent this to you privately - I meant to post it to the list as well...)

Ed Kraft wrote:

>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.
>  

Try

INSERT INTO My_Table (My_Date) VALUE (CURRENT_DATE)

This will give you the current date.  If you're wanting it formatted, 
your best bet is to write a little function in ASP to format yyyy-mm-dd 
(with leading zeroes).  (There is also a CURRENT_TIME and 
CURRENT_TIMESTAMP, if you need those formats.)

You've seen the response of others as well, using MySQL's date format functions...  :)


-- 
Daniel J. Summers
DanielJS@stripped 



-- 
Daniel J. Summers
DanielJS@stripped <mailto:DanielJS@stripped>

Thread
rs.delete won't flyjoe speigle2 Jul
RE: rs.delete won't flyMike Hillyer2 Jul
  • RE: rs.delete won't flyjoe speigle2 Jul
    • RE: rs.delete won't flyEd Carp2 Jul
  • RE: rs.delete won't flyjoe speigle2 Jul
  • RE: rs.delete won't flyEd Carp2 Jul
RE: rs.delete won't flyMike Hillyer2 Jul
  • Inserting Date FieldEd Kraft3 Jul
    • RE: Inserting Date FieldKyle Holder3 Jul
      • RE: Inserting Date FieldEd Kraft3 Jul
        • RE: Inserting Date FieldKyle Holder3 Jul
          • RE: Inserting Date FieldEd Kraft3 Jul
            • RE: Inserting Date FieldKyle Holder3 Jul
              • RE: Inserting Date FieldScott Nichols3 Jul
RE: rs.delete won't flyMike Hillyer2 Jul
Re: Inserting Date FieldMichael Viron4 Jul
Re: Inserting Date FieldDaniel J. Summers5 Jul
RE: Inserting Date Fieldjbonnett7 Jul