显示当前系统日期和时间

How do I show my current system (PC) time on a form

Right now I'm currently using a datetimepicker, I wanna try when I'm going to create something in a form the "time_start" will automatically get the time that is being used on my PC.

<?= $form->field($model, 'time_start')->widget(
    DateTimePicker::className(), [
        'options'       => [ 'placeholder' => 'Render Time' ],
        'pluginOptions' => [ 'autoclose' => true, ]
    ]
); ?>

You can assign the value to $model->time_start directly in your controller before call the render ..

so you problem can be managed in controllerAction using php functin for assign the value you need eg in actionCreate

public function actionCreate()
{
    $model = new MyModel();

    if ($model->load(Yii::$app->request->post()) && $model->save()) {
        return $this->redirect(['view', 'id' => $model->id]);
    } else {
        //  assign the the date and time of the server that the code runs on.
        $model->time_start =  date("d-m-Y H:i:s");
        return $this->render('create', [
            'model' => $model,
        ]);
    }
}

or if you need an specific timezone

public function actionCreate()
{
    $model = new MyModel();

    if ($model->load(Yii::$app->request->post()) && $model->save()) {
        return $this->redirect(['view', 'id' => $model->id]);
    } else {
        //  assign the the date and time of the server that the code runs on.
        //  
        $my_date = new DateTime("now", new DateTimeZone('America/New_York') );

        $model->time_start =   $my_date;
        return $this->render('create', [
            'model' => $model,
        ]);
    }
}