Ebay API ISO 8601 duration format to timestamp
问题 Ebay API provides me time in ISO 8601. For example, it gives me item time left: P0DT0H1M4S Here is how this time is formatted: ebay duration I want to convert this time to simple Y-m-d H:i:s format. So far I've tried date("Y-m-d", strtotime("P0DT0H1M4S")); but it does not work. 回答1: That date interval string is an ISO 8601 duration specification and can be use with DateTime() and DateInterval() $date = new DateTime(); $date->add(new DateInterval('P0DT0H1M4S')); echo $date->format('Y-m-d H:i:s