Results 1 to 4 of 4

Thread: insert date

  1. #1
    Join Date
    Jun 2006
    Posts
    66

    Unanswered: insert date

    how do I insert a date into mysql

    i tried

    insert into mytable(date) values ('03/27/2007') but this just inserts a blank date

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    you gots to use year-month-day sequence in your date literals
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Mar 2007
    Location
    636f6d7075746572
    Posts
    770
    e.g.
    INSERT INTO mytable(`date`) values ('2007-03-27')

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    or '2007.03.27', or 20070327, or '2007X03X27', or ...

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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