Adding a date/time picker to date fields on create pages

Hi there,

My setup is that I have a MySQL database with tables that require various datestamp (including time) to be added by the users of the application. I also need to be able to automatically set date/timestamps automatically when record are created in various tables.

I used Gii to generate all the CRUD views, but I see that it doesn’t add a datepicker on the ‘create’ page for each model.

I would really appreciate it if someone could show me a quick way to do the following:

1 - add a datepicker to the create and update pages generated by Gii.

2 - for date/timestamp fields that I need to automatically set when a record gets created, how do I do this?

Many thanks in advance,


This seems to be the Yii2 api-built-in solution for automatic timestamp

(The 1.1 CTimestampBehavior was included with zii)

Thank you! I am still investigating how to add a manual datepicker for create forms.