PHP - How do I convert between time formats?

I am looking to convert a mysql timestamp to a epoch time in seconds using php, and vice versa. What's the cleanest way to do this?

This question and answers originated from www.stackoverflow.com
Question by (9/22/2008 3:16:15 PM)

Answer

See strtotime and date functions in PHP manual.

$unixTimestamp = strtotime($mysqlDate);
$mysqlDate = date('Y-m-d h:i:s', $unixTimestamp);

Find More Answers
Related Topics  php  mysql  time  timestamp
Related Questions