“P16DT1H58M47S”是什么类型的时间格式?
我正在使用 PHP 解析网站上的一些数据,它以这种格式给出了我的时间量:
P16DT1H58M47S
但它们并不总是有天数,像这样:
PT8H10M3S
有时没有小时数:
PT33M57S
我需要找到一种方法将其转换为总秒数。我不需要将其放入日期对象中,但我想找到一种相当快速的方法来执行此操作,因为我有很多数据需要处理。
I am parsing some data on a website using PHP and it gives me the amount of time in this format:
P16DT1H58M47S
But they don't always have the number of days, like so:
PT8H10M3S
And sometimes no hours:
PT33M57S
What I need to find is a way to convert that to a total number of seconds. I do NOT need to put that into a date object, but I would like to find a fairly quick way to do this as I have a lot of data to go through.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
http://www.php.net/manual/en/dateinterval.construct.php
http://www.php.net/manual/en/dateinterval.construct.php