SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru
    Join Date
    Mar 2006
    Posts
    701
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    date problem for insertion to mysql

    I want to insert to mysql a date filed with pdo.
    The format of the date variable is 09-13-2011 17:11:09 as I see with die($date)
    Also I use this code
    Code:
    $sth = $dbh->prepare($sql);
    $sth->bindValue(":ac_date", $date);
    ..........
    But nothing is inserting at my db.
    What is wrong?
    Thank you.

  2. #2
    SitePoint Member
    Join Date
    Sep 2011
    Location
    Moscow. RU
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello, on how i remember right format must be "year-month-day hour:minute:seconds". hope it help you.

  3. #3
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    72 Post(s)
    Tagged
    0 Thread(s)
    Yes, as inky states, the correct format (in PHP's Date-String) is Y-m-d H:i:s (or YYYY-MM-DD HH:MM:SS).


Bookmarks

Posting Permissions

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