src/Alg/Time/Converter.php
public static function convertToHuman( $timestamp, $format )
	{
		$human = "";
		if( $format == "date" )
			$human = date( "d.m.Y", (int) $timestamp );
		else if( $format == "monthdate" )
			$human = date( "m.Y", (int) $timestamp );
		else if( $format == "time" )
			$human = date( "H:i:s", (int) $timestamp );
		else if( $format == "datetime" )
			$human = date( "d.m.Y - H:i:s", (int) $timestamp );
		else if( $format == "duration" )
		{
			$hours	= str_pad( floor( $timestamp / 3600 ), 2, 0, STR_PAD_LEFT );
			$timestamp -= $hours * 3600;
			$mins	= str_pad( floor( $timestamp / 60 ), 2, 0, STR_PAD_LEFT );
			$timestamp -= $mins * 60;
			$secs	= str_pad( $timestamp, 2, 0, STR_PAD_LEFT );
			$human	= $hours.":".$mins.":".$secs;
		}
		else if( $format )
			$human = date( $format, (int)$timestamp );
		if( $human )
			return $human;
	}
public static function convertToHuman( $timestamp, $format )
	{
		$human = "";
		if( $format == "date" )
			$human = date( "d.m.Y", (int) $timestamp );
		else if( $format == "monthdate" )
			$human = date( "m.Y", (int) $timestamp );
		else if( $format == "time" )
			$human = date( "H:i:s", (int) $timestamp );
		else if( $format == "datetime" )
			$human = date( "d.m.Y - H:i:s", (int) $timestamp );
		else if( $format == "duration" )
		{
			$hours	= str_pad( floor( $timestamp / 3600 ), 2, 0, STR_PAD_LEFT );
			$timestamp -= $hours * 3600;
			$mins	= str_pad( floor( $timestamp / 60 ), 2, 0, STR_PAD_LEFT );
			$timestamp -= $mins * 60;
			$secs	= str_pad( $timestamp, 2, 0, STR_PAD_LEFT );
			$human	= $hours.":".$mins.":".$secs;
		}
		else if( $format )
			$human = date( $format, (int)$timestamp );
		if( $human )
			return $human;
	}
public static function convertToHuman ( $ timestamp , $ format ) { $ human = "" ; if ( $ format == "date" ) $ human = date ( "d.m.Y" , ( int ) $ timestamp ) ; else if ( $ format == "monthdate" ) $ human = date ( "m.Y" , ( int ) $ timestamp ) ; else if ( $ format == "time" ) $ human = date ( "H:i:s" , ( int ) $ timestamp ) ; else if ( $ format == "datetime" ) $ human = date ( "d.m.Y - H:i:s" , ( int ) $ timestamp ) ; else if ( $ format == "duration" ) { $ hours = str_pad ( floor ( $ timestamp / 3600 ) , 2 , 0 , STR_PAD_LEFT ) ; $ timestamp -= $ hours * 3600 ; $ mins = str_pad ( floor ( $ timestamp / 60 ) , 2 , 0 , STR_PAD_LEFT ) ; $ timestamp -= $ mins * 60 ; $ secs = str_pad ( $ timestamp , 2 , 0 , STR_PAD_LEFT ) ; $ human = $ hours . ":" . $ mins . ":" . $ secs ; } else if ( $ format ) $ human = date ( $ format , ( int ) $ timestamp ) ; if ( $ human ) return $ human ; }
Converts Unix Timestamp to a human time format.
@access		public
@static
@param		string	$timestamp		Unix Timestamp
@param		string	$format			Format of human time (date|monthdate|datetime|duration|custom format)
@return		string
Converts Unix Timestamp to a human time format .