-1

I have a mysql table that I created like this:

CREATE TABLE `Table` (
  `Table_id` int(11) NOT NULL AUTO_INCREMENT,
  `Table_date` datetime NOT NULL,
  `Table_modified` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
               ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`Played_id`))
  ENGINE=MyISAM AUTO_INCREMENT=18 DEFAULT CHARSET=utf8

Now I try to call the INSERT query:

INSERT INTO Table (`Table_date`) VALUES ('04/12/2015 16:50:35')

and it doesn't work. I get the confirmation that one row was inserted, but all I see is value 0000-00-00 00:00:00 as a Table_date. The timestamp in Table_modified is fine, it's current value, but only zeros in Table_date really bugs me. I know it's impossible to store two timestamps in database, that's why I've decided to switch and use the type Datetime as for Table_date, so far with no success. How can I fix it and fill that column with the time provided?

wallyk
  • 56,922
  • 16
  • 83
  • 148
randomuser2
  • 107
  • 10

1 Answers1

2

You have the format for the date part wrong. Try this:

INSERT INTO Table (`Table_date`) VALUES ('2015-04-12 16:50:35')
mmking
  • 1,564
  • 4
  • 26
  • 36