Link to home
Start Free TrialLog in
Avatar of rgb192
rgb192Flag for United States of America

asked on

mysql datetime field

convert a php date time

to be saved in mysql

in a mysql datetime field
Avatar of arnold
arnold
Flag of United States of America image

Please explain what it is you have and what you want.
IMHO it is better to store the unix timestamp int(13) seconds since epoch January 1st 1970 GMT. In this format date manipulation, comparisons are straight forward mathematical computation versus having to use date functions to convert strings and then etc.
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You should not set/use dates for setting in you php code, now() is a mysql function that should be used to insert dates for for uniformity eliminating time differences fluctuations.
https://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_201-Handling-date-and-time-in-PHP-and-MySQL.html explains it all.  Learn about the ISO-8601 standard.  Make all internal representations of datetime values conform to the standard.
Avatar of rgb192

ASKER

this is the exact format that allows me to insert

thanks