DateTime error while insert to MySQL

Alternatively, you can automatically re-format your date string to SQL-99 format using STR_TO_DATE():

STR_TO_DATE( '17/07/2013 18:33:55', '%d/%m/%Y %H:%i:%s')

So the INSERT statement would be:

INSERT INTO wngtest.sitereading 
(idSiteReading, TimeStamp, SiteLocation, Flow, Temperature1, Temperature2) 
VALUES ('1', 
STR_TO_DATE( '17/07/2013 18:33:55', '%d/%m/%Y %H:%i:%s'), 
'WNGSite1', '13.1', '81', '45');

In MySql dates should be inserted in yyyy-mm-dd format

Try using the format:

2013-07-17 17:18:55

Full Insert Statement:

INSERT INTO wngtest.sitereading 
(idSiteReading, TimeStamp, SiteLocation, Flow, Temperature1, Temperature2) 
VALUES ('1', '2013-07-17 18:33:55', 'WNGSite1', '13.1', '81', '45');

Tags:

Mysql

Insert