Problem to update

Hi,
Any advice to this error?
17:08:24	update package set sms_time = STR_TO_DATE('1/4/2015 15:30:00','%d/%m/%Y %h:%i:%s') where id = 640725
	0 row(s) affected, 1 warning(s): 1411 
Incorrect datetime value: '1/4/2015 15:30:00' for function str_to_time
 Rows matched: 1  
Changed: 0  
Warnings: 0	
0.000 sec
				

Open in new window

LVL 12
HuaMin ChenProblem resolverAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AndyAinscowFreelance programmer / ConsultantCommented:
What is the %i in the format of the time part?  I think that should be %m
HuaMin ChenProblem resolverAuthor Commented:
I got the same                        
17:53:15	update package set sms_time = STR_TO_DATE('1/4/2015 15:30:00','%d/%m/%Y %h:%m:%s') where id = 640725	0 row(s) affected, 1 warning(s): 1411 Incorrect datetime value: '1/4/2015 15:30:00' for function str_to_time Rows matched: 1  Changed: 0  Warnings: 0	0.000 sec

Open in new window

when using "m" instead.
AndyAinscowFreelance programmer / ConsultantCommented:
Hmm.  I've just checked the documentation, your %i was correct in the first place.

The problem could well be the %h - it looks like you need %H
Easwaran ParamasivamCommented:
Why can't use CONVERT function to convert string to date? The format in which you'd like to convert could be passed as last parameter.

http://www.techonthenet.com/sql_server/functions/convert.php
Guy Hengel [angelIII / a3]Billing EngineerCommented:
%d is incorrect, it must be %e, as %d is expecting the day part to be 2 digit
%m is incorrect, it must be %c (same reason)
https://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-format

STR_TO_DATE('1/4/2015 15:30:00','%e/%c/%Y %h:%i:%s')

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.