freshbrewedweb/php-timecode

Easy management of timecodes

dev-master 2019-12-31 03:29 UTC

This package is auto-updated.

Last update: 2024-11-29 06:10:00 UTC


README

Easy management of timecodes

Usage

$timecode = new Timecode(1122 , 'seconds');

echo $timecode->get();
// 00:18:42.000

// Get is optional, you can just echo the object.
echo $timecode
    ->setUnits(['minutes', 'seconds', 'milliseconds'])
    ->setFormat('%02d:%02d,%02d');

// 18:42,000

echo $timecode->hours;
// 0

echo $timecode->minutes;
// 18

echo $timecode->seconds;
// 42

We can go the other direction too:

$timecode = Timecode::fromString('00:18:42.000');