PHP date() format when inserting into datetime in MySQL -


what correct format pass date() function in php if want insert result mysql datetime type column?

i've been trying date("y-m-d g:i:s") inserts "0000-00-00 00:00:00" everytime.

the problem you're using 'm' , 'd', textual representations, mysql expecting numeric representation of format 2010-02-06 19:30:13

try: date("y-m-d h:i:s") uses numeric equivalents.

edit: switched g h, though may not have impact, want use 24-hour format leading 0s.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -