Horst Walter Horst Walter - 1 year ago 117
MySQL Question

Convert mysql DB timestamp to int time for PHP touch

I have a mysql timestamp which looks like this:

2016-08-31 21:54:33
. I need to use this timestamp in PHP touch:
bool touch ( string $filename [, int $time = time() [, int $atime ]] )

How can I best convert into the
value needed in

Answer Source

In an object oriented syle:

$dateTime = new DateTime("2016-08-31 21:54:33");
echo $dateTime->getTimestamp();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download