Create Custom fields using tpl


I want to create related field using tpl file just like studio field.
What are the steps to create it.

Also want to create date time field with tpl , guide me steps for it.

Make Studio do it, record what it does, then do it manually.

This is how: