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"

有帮助吗?

解决方案

Do you really need a built-in function to do:

$seconds = strtotime('10:30 pm') - strtotime('00:00');
var_dump($seconds);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top