Timer assigned to button

It would be nice if it was possible to assign a timer to a button so that it itself turns off after e.g. 20 minutes
Regards Bo