The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

MySQL Timestamp vs PHP Timestamp

Hello, I though they were interchangeable but I just inserted a PHP timestamp to a MySQL timestamp field and it just assumed an all zeros date.

If I want to use the PHP timestamp, should I use a INT field in MySQL, instead of timestamp?

Thursday, October 25, 2007
The MySQL timestamp format differs drastically from the PHP timestamp.  Here's how to generate a MySQL timestamp with PHP code:

$mysq_timestamp = date("Y-m-d H:i:s");
Daemon Send private email
Thursday, October 25, 2007
Well I though timestamp was always the number of seconds since Jan 1st 1970. But it seams thats the "unix timestamp".

Thanks. :)
Thursday, October 25, 2007
you can also do the conversion in mysql to

UPDATE table1 SET tstamp = FROM_UNIXTIME($phptimestamp);
Thursday, October 25, 2007

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz