<?php

class DateIntervalEnhanced extends DateInterval
{
  public static function recalculateStatic($obj)
  {
    $from = new DateTime;
    $to = clone $from;
    $to = $to->add($obj);
    $diff = $from->diff($to);
    foreach ($diff as $k => $v) $obj->$k = $v;
    return $obj;
  }

  public static function getFormattedFromString($time)
  {
    $obj = DateInterval::createFromDateString($time);
    $obj = self::recalculateStatic($obj);
    return $obj->format('%H:%I:%S');
  }
}
