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
Post a Comment