There are several different ways to do this, but one of the easiest is to use the power allowance feature.
There are two different ways to use power allowance.
In one, you always limit a specific device to a specific amount of time. That was the original use of power allowance and that is how the official features usually assume that it will be used. You can use the official smart lighting featured to apply this.
The other way is to set up a virtual timer and apply power allowance to the virtual timer, then have the actual physical device follow the virtual timer so that it turns on when the virtual timer turns on and turns off when the virtual timer turns off. This approach has the advantage of letting you use other methods for controlling the physical device as well, for example if you just toggle it in the things List in the SmartThings mobile app then it would stay on until you turned it off again. If you toggle the virtual timer instead, then it would come on for that amount of time and turn off again. So it just gives you more options.
There is a how to article in the community – created wiki on setting up a virtual timer if you want to go that way: