How do you deal with dates in mySQL/PHP (I'm new to this).
My table has a DateTime field, and I insert the results of the time() function to it. The table always shows 00:00:00 etc for the value. (this is in phpMyAdmin).
I changed the table types and found that when I use something like bigint(20) I see the same value of the time() function in there as when I output my sql in the webpage to see what it's putting in the database.
When I apply the date formatting function from PHP on the number that was in the bigint field, (the thing that's suppose to be the date) with this type of code:
date("j-M-Y", $myrow['date_entered']) I get a date of dec 31 1969????
I'm confused. All I want to do is dump the date to a field in my DB and then get it back in a user readable format.
Sorry if I asked a question that's been asked a million times, but any answers will be welcome!
Thank you.
Just to recap in case my problem wasnt clear:
I am inserting the value returned from time() into a field in my table.
When the field type is datetime, the value in the field is always zeros. (00:00:00 00:00:00). When I change the type to bigint(20) and insert the same time() value I see the same number that I test-output to a web page.
When I use the bigint type, and pull it back out, and apply the date() function to it to format it, I get a year of 1969 and because of this I am stymied.
UGH!