Re: timestamp problem
| From: | Sebastian Mendel | Date: | Thu, 18 Nov 2004 16:00:25 +0000 |
| Subject: | Re: timestamp problem | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-37333@lists.php.net to get a copy of this message | ||
Doug Parker wrote:
I'm trying to format a MySQL Timestamp Column Type with PHP, and it's not going well. In reading up on it, I see that the idea is to convert the Timestamp type to Unix format using the strtotime() function, then using the date() function to format that result. However, this only appears to work with MySQL versions above 4.1 - where the Timestamp has been modified to have the ":" symbol in between the approprate numbers, as opposed to the traditional extended format (i.e. 20041117104300), which can be found on Mysql versions 4.0xx and below. I have > MySQL 4.1 on my local machine, but MySQL 4.0 something on the box I'm publishing to - which is obviously the more important box. So I need to get it working using the regular format. And I don't want to just parse the characters because I have a bunch of timestamp columns and don't really think it's that great of a resolution.SELECT UNIX_TIMESTAMP(
mysql_timestamp)
or
SELECT DATE_FORMAT( ... )
--
Sebastian Mendel
www.sebastianmendel.de www.warzonez.de www.tekkno4u.de www.nofetish.com
www.sf.net/projects/phpdatetime www.sf.net/projects/phptimesheet