How to convert MYSQL into Readable PHP timestamp
I have timestampt format in Mysql which is of 15 field and that is using date('F d Y', $timestamp); but when i used this format in my programming it won't execute. I am aware about the DATE_FORMAT() function in Mysql but I would like to know if there is a way to do this in PHP?
Re: How to convert MYSQL into Readable PHP timestamp
If you wanted to get an output into mysql timestamp you need to use the following the query
i.e.SELECT DATE_FORMAT(time, '%F %d %Y') as new_time,table.* FROM table
The new_time would be the formatted timestamp and the time you are using will be the the mysql timestamp.
Re: How to convert MYSQL into Readable PHP timestamp
I have gone through some book reading and I found that date timestamp does not work according to requirement it shows totally different output but date it also doesn't work on a TIMESTAMP field instead of that it works on a DATE field, when i tried doing that It does formatting the date on a TIMESTAMP field but it gives a wrong date. For example:
$timestamp = '20050420118004';
$date = date("F-d-Y", $timestamp);
print($date); // Returns January-18-2038 when it should be March-11-2005