The strtotime
function does not seem to be working when attempting to convert a string containing microseconds into a unix timestamp. I don't care about keeping the microseconds in the unix timestamp.
Example:
$date = '2017-03-21-10:58:01.7888';
echo strtotime($date); // always outputs 0
The format with microseconds is not supported by PHP, see the list of compound formats (date and time). You have to convert it to a supported format. If the timestamp is guaranteed to use this format, you can split it at the dot and then use the first part to obtain the timestamp without microseconds:
echo strtotime(split(".", $data)[0]);