You are here

public function FeedsYoutubeParser::youTubeTimetoDuration in Feeds: YouTube Parser 7.3

Convert youtube video duration to time interval.

Parameters

$duration: Youtube API V3 vdieo duration.

1 call to FeedsYoutubeParser::youTubeTimetoDuration()
FeedsYoutubeParser::parseVideoItems in plugins/FeedsYoutubeParser.inc
Parse YouTube video feed.

File

plugins/FeedsYoutubeParser.inc, line 141
Feeds parser class for YouTube.

Class

FeedsYoutubeParser
Class definition for YouTube Parser.

Code

public function youTubeTimetoDuration($duration) {
  $di = new DateInterval($duration);
  $string = '';
  if ($di->h > 0) {
    $string .= $di->h . ':';
  }
  return $string . $di->i . ':' . $di->s;
}