Error Number 1292
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up error code 1292 incorrect date value mysql up vote 8 down vote favorite 5 I have a table `CREATE TABLE IF NOT EXISTS `PROGETTO`.`ALBERGO` ( `ID` INT(11) NOT NULL COMMENT 'identificativo dell\' albergo' , `nome` VARCHAR(45) NULL COMMENT 'Il nome dell\'albergo' , `viale` VARCHAR(45) NULL COMMENT 'Il viale in cui si trova ' , `num_civico` VARCHAR(5) NULL COMMENT 'Il numero civico che gli appartiene' , `data_apertura` DATE NULL COMMENT 'Data di inizio apertura (inizio stagione)' , `data_chiusura` DATE NULL COMMENT 'Data di chiusura (fine stagione)' , `orario_apertura` TIME NULL COMMENT 'Orario di apertura' , `orario_chiusura` TIME NULL COMMENT 'Orario di chiusura' , `posti_liberi` INT(11) NULL COMMENT 'Disponiblità posti liberi ' , `costo_intero` FLOAT NULL COMMENT 'Costo del prezzo intero' , `costo_ridotto` FLOAT NULL COMMENT 'Costo del prezzo ridotto' , `stelle` INT(11) NULL COMMENT 'Classificazione in base al criterio delle stelle' , `telefono` VARCHAR(15) NULL COMMENT 'Recapito telefonico' , `mail` VARCHAR(100) NULL COMMENT 'Recapito e-mail' , `web` VARCHAR(100) NULL COMMENT 'Sito Web relativo all\'ente' , 'Nome-paese` VARCHAR(45) NOT NULL COMMENT 'Identificativo del paese in cui si trova l\'albergo' , `Comune` CHAR(2) NOT NULL COMMENT 'Identificativo del comune in cui si trova l\'albergo' , PRIMARY KEY (`ID`) , INDEX `Nome-paese` (`Nome-paese` ASC) , INDEX `Comune` (`Comune` ASC) , CONSTRAINT `Nome-paese` FOREIGN KEY (`Nome-paese` ) REFERENCES `PROGETTO`.`PAESE` (`Nome-paese` ) ON DELETE NO ACTION ON UPDATE CASCADE, CONSTRAINT `Comune` FOREIGN KEY
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Error code 1292 incorrect Date http://stackoverflow.com/questions/14625191/error-code-1292-incorrect-date-value-mysql | Time up vote 0 down vote favorite Here is the SQL statement I am trying to enter: INSERT INTO comments values (default, 'lars','myemail@gmail.com','http://www.vogella.com', '2009-09-14 10:33:11', 'Summary','My first comment'); But I'm getting a 1292 error about my date and time('2009-09-14 10:33:11'). I don't understand, the format seems to be correct. What am I missing? mysql sql date mysql-error-1292 share|improve this question edited Dec 2 '13 at http://stackoverflow.com/questions/20322544/error-code-1292-incorrect-date-time 7:14 asked Dec 2 '13 at 7:01 Milap 82112 I posted my entire query if that's what you mean –Milap Dec 2 '13 at 7:05 add a comment| 2 Answers 2 active oldest votes up vote 1 down vote accepted Try this out: INSERT INTO comments values ('lars', 'myemail@gmail.com','http://www.vogella.com', '2009-09-14', 'Summary','My first comment'); You seem to be sending a datetime while your field is a date. Probably you should change your table structure from date to datetime. share|improve this answer answered Dec 2 '13 at 7:07 Mosty Mostacho 28.6k85689 1 Thanks that was it! I guess if anyone that sees this is following this guide: vogella.com/articles/MySQLJava/article.html Then make this correction! –Milap Dec 2 '13 at 7:13 add a comment| up vote 1 down vote Use to_date function. to_date('2009-09-14 10:33:11',yyyy-MM-dd hh:mm:ss) share|improve this answer answered Dec 2 '13 at 8:05 dpk 30518 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the pri
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers http://stackoverflow.com/questions/23581687/mysql-error-invalid-datetime-format-1292-incorrect-datetime-value-for-col or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up MySQL error - Invalid datetime format: 1292 Incorrect datetime value: '' for column up vote 5 down vote favorite 1 I am using mysql in Os X 10.9.2 and when I try to run error number my php website in local I have this error: Invalid datetime format: 1292 Incorrect datetime value: '' for column nameOfTheColumn The Error happens when I tried to insert an empty value in a datetime field. The site works fine in production and in some other locals computers, so the problem is in database and I have to be solve in my local database. Reading about the problem I read that mysql could be running in Strict mode, so I edit /usr/local/mysql/my.cnf error number 1292 and I comment out this line: #sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES I restart computer and still is not working, but according to the documentation online and others questions, this is the way, but I would like to know What is it the exactly change I have to do to make my application works. Repeat, the code works in production, windows with xampp, etc... so can not be change because is to long and just for work in local I need the right change in MYSQL DATABASE. Thanks in advance! php mysql osx datetime share|improve this question edited May 5 at 6:10 luchaninov 2,45232558 asked May 10 '14 at 13:34 daveloper 44118 1 does your datetime column allow null ? –user3470953 May 10 '14 at 13:36 Yes It does, but I repeat the site works well in production and in other locations like my windows PC with xampp. I can not change the database structure and the code. The problem is in mysql configuration, I read about this but at the end I do not know what it is the exactly change I have to do in my.cnf or other related file. –daveloper May 10 '14 at 14:02 have you already thought of simply copying the mysql configuration from one of the working installations onto your computer? don't forget to modify the pathes for mysql datadir, sockets accordingly. –Kaii May 10 '14 at 14:06 @developer even