freshbrewedweb/php-timecode

时间码的简易管理

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

This package is auto-updated.

Last update: 2024-08-29 05:16:04 UTC


README

时间码的简易管理

用法

$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

我们也可以反过来

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