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

后端 未结 2 1547
囚心锁ツ
囚心锁ツ 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-19 23:59

    It is an ISO 8601 duration.

    See this brief overview: http://en.wikipedia.org/wiki/ISO_8601#Durations

    Many languages have tools available to work with them, including PHP in the form of DateInterval.

    0 讨论(0)
  • 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');
    
    0 讨论(0)
提交回复
热议问题