Reputation: 3284
does php have any built-in functionality to convert a readable time-string
(stressing time
, not datetime
) with the same relaxed format allowed by strtotime to a offset in seconds from beginning of day.
php DateTime
or strtotime
seem to only work with date-times
like "12-07-13 10:30:00"
what i really want is a generic time (no date) like "10:30pm" or "23:30 or "13-15" etc.
should become something like "81000", "84600", "47700"
Upvotes: 1
Views: 1309
Reputation: 212412
Do you really need a built-in function to do:
$seconds = strtotime('10:30 pm') - strtotime('00:00');
var_dump($seconds);
Upvotes: 2