I have this time string from sql 00:05:00
and I need a timestamp from it but can't seem to get it. I have also tried strtotime.
What am I doing wrong?
$NonBillable = '00:05:00';
$NonBillable = DateTime::createFromFormat('H:i:s', $NonBillable)->getTimestamp();
echo $NonBillable;
$NonBillable = DateTime::createFromFormat('H:i:s', '00:05:00');
echo $NonBillable->getTimestamp();
It results for me 1464480300
-> Sun, 29 May 2016 00:05:00 GMT
because no date has been given, it uses today.
So a simple solution to this would be:
echo $NonBillable->getTimestamp() - time();