A good rule of thumb is that a dog can be crated overnight and for up to half the day, provided his social and physical needs are being met while not in the crate.
Young puppies need more frequent naps and much more frequent opportunities to "do their business" than adults.