Results 1 to 3 of 3

Thread: Date datatype

  1. #1
    Join Date
    Jan 2005

    Question Unanswered: Date datatype

    Hi guys, i'm not new to sql, but its my first time using mysql. i am creating a new table and keep getting errors when trying to insert a date feild or time feild:

    create table MessageBoard
    MessageID char(10) not null,
    MemberID char(10) not null,
    Topic varchar(50) not null,
    Description varchar(250) not null,
    Expiry_Date date 'yyyy-mm-dd' not null,
    Start_time time 'hh:mm:ss',
    Date/Time timestamp 'yyyy-mm-dd hh:mm:ss' not null,

    CONSTRAINT MessageBoard_pk
    PRIMARY KEY (MessageID),

    I keep getting a syntax error for the two date feilds and time feild? i havn't got a clue what i'm doing wrong? is inserting a date feild different in mysql to SQL server?

    i'd appreciate any help plzzzz, thanks for your time...
    Last edited by parmy; 01-24-05 at 09:21.

  2. #2
    Join Date
    Mar 2004
    Those are the correct types, but you don't have to say anything more than date or timestamp. You can't specify yyyy-mm-dd since they are only accepted that way and don't accept other input.

    You can use DATE_FORMAT when pulling your results to format the date or timestamp in various ways. See the manual for that.

  3. #3
    Join Date
    Jan 2005


    thanks 4 da advice

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts