Reputation:
I made a table in mysql, with for example date_birth date
;
and then tried to insert a date like this in it date('Y-m-d H:i:s')
but the inserted date is like this format 2012-08-02
, so do you know what's wrong? or maybe for long format of date is shouldn't use date in mysql ?
thanks!!
Upvotes: 0
Views: 127
Reputation:
MySQL is correct:
DATE(expr) Extracts the date part of the date or datetime expression expr.
https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date
Upvotes: 1
Reputation: 5685
Alter your mysql table with date_birth DATETIME
instead of date_birth DATE
You can do this with below query:
ALTER TABLE table_name MODIFY COLUMN date_birth DATETIME
and then if you insert date like date('Y-m-d H:i:s')
it will take full date time not just date
Upvotes: 0