How do you enter a date into a MySQL field? I've been trying to do it like this:
But it keeps coming out as: 0000-00-00 :confused:PHP Code:date("Y-d-m")
Printable View
How do you enter a date into a MySQL field? I've been trying to do it like this:
But it keeps coming out as: 0000-00-00 :confused:PHP Code:date("Y-d-m")
I tend to do mine like so:
PHP Code:$date = date("Y-d-m");
mysql_query("insert into tableName (completeDate) values ('$date')";
This doesn't help me at all.
I just can't figure this out :mad:
make sure the field type varchar and not int
the field is date
oh. I always used varchar and never had any problems, and I have no idea how date works.
I just realized I had the format wrong. It needs to be:
PHP Code:date("Y-m-d")