This is the simplest concept in programming, but for some reason I just can't get it to work. I'm querying a database for a record set that will either contain 1 record or 0 records. 1 of the fields in the record is a MySQL timestamp. Problem is, I can't seem to get the timestamp to display correctly. This is what I have:
Timestamp = 20020211192917
display code = echo date ( "d.M.Y", $last_update );
Result = 18.Jan.2038
Also, if the recordset returns 0 records (and last_update is, therefore, empty), the result is "31.Dec.1969". I can work around this, but I'd still like to know the cause.
I'm running PHP4 and MySQL 3.23 on a W2K box. The query I'm executing is being built in a string variable, so it chokes on any attempt to use MySQL date functions.
Any insight on how PHP handles dates would be greatly appreciated. Ultimately, I could get around this with a lot of conditionals, but it seems like there must be a more sophisticated way. I'm also trying to figure out what I can and can't do with PHP rather than just "make it work".
Thanks.