daGrevis daGrevis -4 years ago 171
MySQL Question

How to convert MySQL time to UNIX timestamp using PHP?

There are a lot of questions that ask about 'UNIX timestamp to MySQL time'. I needed the reversed way, yea... Any idea?

Answer Source

Use strtotime(..):

$timestamp = strtotime($mysqltime);
echo date("Y-m-d H:i:s", $timestamp);

Also check this out (to do it in MySQL way.)


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download