public static function tag($time, $options = [])
    {
        if ($time) {
            if (!static::$isRegistered) {
                TimeagoAsset::register(Yii::$app->getView());
                self::$isRegistered = true;
            }

            Html::addCssClass($options, 'timeago');
            $options['datetime'] = Yii::$app->getFormatter()->asDatetime($time, "php:c");

            return Html::tag('time', Yii::$app->getFormatter()->asDatetime($time), $options);
        }
    }
public static function tag($time, $options = [])
    {
        if ($time) {
            if (!static::$isRegistered) {
                TimeagoAsset::register(Yii::$app->getView());
                self::$isRegistered = true;
            }

            Html::addCssClass($options, 'timeago');
            $options['datetime'] = Yii::$app->getFormatter()->asDatetime($time, "php:c");

            return Html::tag('time', Yii::$app->getFormatter()->asDatetime($time), $options);
        }
    }
public static function tag ( $ time , $ options = [ ] ) { if ( $ time ) { if ( ! static :: $ isRegistered ) { TimeagoAsset :: register ( Yii :: $ app -> getView ( ) ) ; self :: $ isRegistered = true ; } Html :: addCssClass ( $ options , 'timeago' ) ; $ options [ 'datetime' ] = Yii :: $ app -> getFormatter ( ) -> asDatetime ( $ time , "php:c" ) ; return Html :: tag ( 'time' , Yii :: $ app -> getFormatter ( ) -> asDatetime ( $ time ) , $ options ) ; } }
Renders time tag.

@param int|string|\DateTime $time
@param array $options
@return string
Renders time tag .