core/web/jsonld/DurationValue.php
protected function timeToIso8601Duration($time)
    {
        $units = array(
            "Y" => 365*24*3600,
            "D" =>     24*3600,
            "H" =>        3600,
            "M" =>          60,
            "S" =>           1,
        );
        
        $str = "P";
        $istime = false;
        
        foreach ($units as $unitName => &$unit) {
            $quot  = intval($time / $unit);
            $time -= $quot * $unit;
            $unit  = $quot;
            if ($unit > 0) {
                if (!$istime && in_array($unitName, array("H", "M", "S"))) { // There may be a better way to do this
                    $str .= "T";
                    $istime = true;
                }
                $str .= strval($unit) . $unitName;
            }
        }
        
        return $str;
    }
protected function timeToIso8601Duration($time)
    {
        $units = array(
            "Y" => 365*24*3600,
            "D" =>     24*3600,
            "H" =>        3600,
            "M" =>          60,
            "S" =>           1,
        );
        
        $str = "P";
        $istime = false;
        
        foreach ($units as $unitName => &$unit) {
            $quot  = intval($time / $unit);
            $time -= $quot * $unit;
            $unit  = $quot;
            if ($unit > 0) {
                if (!$istime && in_array($unitName, array("H", "M", "S"))) { // There may be a better way to do this
                    $str .= "T";
                    $istime = true;
                }
                $str .= strval($unit) . $unitName;
            }
        }
        
        return $str;
    }
protected function timeToIso8601Duration ( $ time ) { $ units = array ( "Y" => 365 * 24 * 3600 , "D" => 24 * 3600 , "H" => 3600 , "M" => 60 , "S" => 1 , ) ; $ str = "P" ; $ istime = false ; foreach ( $ units as $ unitName => & $ unit ) { $ quot = intval ( $ time / $ unit ) ; $ time -= $ quot * $ unit ; $ unit = $ quot ; if ( $ unit > 0 ) { if ( ! $ istime && in_array ( $ unitName , array ( "H" , "M" , "S" ) ) ) { // There may be a better way to do this $ str .= "T" ; $ istime = true ; } $ str .= strval ( $ unit ) . $ unitName ; } } return $ str ; }
Convert time to iso date.

@see https://stackoverflow.com/a/13301472/4611030
@param integer $time
@return string
Convert time to iso date .