Disclaimer: If you have an iPhone 5, 4S, or 4; an iPad 3 or 2; or an iPod touch 5 or 4, then this will work for you. That is, after you download iOS 6.
Go into the settings of your iPod, iPad, or iPhone.
Go into your notifications.
Go into the "Do Not Disturb" menu.
This is the screen you'll see.
Turn on "Scheduled" to bring up the time option.
You can choose how long "Do Not Disturb" will be on (During the night, during school, during your nap...).
Remember the "Allow Calls From" menu? Here's what it looks like.
Don't know if you can see it that well, but there's the crescent that shows next to the clock on your device. Pretty nifty...
Tip: This only works when your iOS device is locked. So, you'll have to find another way to keep someone texting you while finishing up an Angry Birds game.