Usually, users face the opposite problem — preventing the computer from going to sleep. But sometimes you do want the display or the Mac to turn off after a certain amount of time.
That’s exactly what SleepBar is for: it lets you set a timer and either turn off the monitor or put your Mac to sleep.

You can try SleepBar for free for a week. After that, you’ll need to purchase a license for $4.20.