jthompson
jthompson

Reputation: 921

Easily parse time durations in PHP

Along the lines of the ridicolously simple strtotime() function, Is there a simple way to parse strings such as "1 hour 30 mins", "1.5 hours", "90 mins", "an hour and a half" into an integer value representing the corresponding number of seconds?

Upvotes: 3

Views: 988

Answers (1)

joetsuihk
joetsuihk

Reputation: 534

i think what you need to convert to seconds:

strtotime('+1 hour 30 mins') - time()

Upvotes: 7

Related Questions