Incorrect datetime value: storing date from php in MySQL
Posted: Thu Nov 09, 2006 10:48 am
Hi,
I am trying to store date in the MySQL. Here is my code to get start time and end time(5 min later)
I have tried to add and to MySQL table with attribute type 'datetime' or 'timestamp'. I have tryed just a timestamp format(time()) or other formats for $start,$end values, but it always gives the error:
Incorrect datetime value: '06-11-09am06 07:44:11' for column 'end_time' at row 1
How to store date in MySQL?
We are running: PhpMyAdmin 2.8.2.4, MySQL 5.0, Php 5.1.6, Apache 2.0.5.8
Thank You,
I am trying to store date in the MySQL. Here is my code to get start time and end time(5 min later)
Code: Select all
$start = time();
$day=date("d",$start);
$year=date("y",$start);
$month=date("m",$start);
$hour=date("H",$start);
$min=date("i",$start);
$sec=date("s",$start);
$start = date("y-m-d H:i:s",$start);
$end=mktime($hour,$min+5,$sec,$month,$day,$year);
$end=date("y-m-day H:i:s",$end);Code: Select all
$startCode: Select all
$endIncorrect datetime value: '06-11-09am06 07:44:11' for column 'end_time' at row 1
How to store date in MySQL?
We are running: PhpMyAdmin 2.8.2.4, MySQL 5.0, Php 5.1.6, Apache 2.0.5.8
Thank You,