开发者

Easily parse time durations in PHP

开发者 https://www.devze.com 2022-12-17 14:04 出处:网络
开发者_StackOverflowAlong 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

开发者_StackOverflowAlong 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?


i think what you need to convert to seconds:

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

精彩评论

暂无评论...
验证码 换一张
取 消