Helper::human_time( int $seconds )

Create a HH:MM:SS from a timestamp.


Description

Given a number of seconds, the function returns a readable duration formatted as HH:MM:SS


Parameters

$seconds

(int) (Required) Number of seconds.


Return

(string) The formatted time.


Source

File: includes/libs/helper.class.php

	public static function human_time( $seconds ){

		$seconds = absint( $seconds );

		if( $seconds < 0 ){
			return;
		}

		$h = floor( $seconds / 3600 );
		$m = floor( $seconds % 3600 / 60 );
		$s = floor( $seconds %3600 % 60 );

		return ( ($h > 0 ? $h . ":" : "") . ( ($m < 10 ? "0" : "") . $m . ":" ) . ($s < 10 ? "0" : "") . $s);
	}

Start your video site now!

Manage and coordinate your Vimeo channels, albums or videos with your WordPress website. Perfect fit for membership, portfolio, online courses or any type of video collection.

Get Vimeotheque PRO!