Sleeping pills can take from 20 to 40 minutes to take affect and make you drowsy and sleepy.
Different sleeping pills work different and takes different times to work but usually the sleeping pills I take will make me sleepy within 30 minutes of taking the sleeping pills.
So it's recommended to take your sleeping pills at least 30 minutes before going to bed.