What is the name of the time format PT00H00M00S and what languages use it?

后端 未结 2 1546
囚心锁ツ
囚心锁ツ 2021-01-19 23:25

I\'m working with excel documents using PHP scripts and cannot determine what data type/format PT00H00M00S is, and subsequently I can\'t find a way to work with it without u

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-20 00:12

    It's a time interval, where the P means period. You can use PHP's DateInterval() to parse the string.

    For example (example taken from the PHP documentation):

    $interval = new DateInterval('P2Y4DT6H8M');
    echo $interval->format('%d days');
    

提交回复
热议问题