Most sleeping pills kick in and help you fall asleep within 20 to 30 minutes.
So when you're ready to go to bed you should take the sleeping pills at least 30 minutes before going to bed.
After taking a sleeping pill I'm usually starting to become drowsy within 25 minutes which allows me enough time walk to my bedroom and then after I lay down in bed I'm usually drifting off to sleep.
Sometimes I also still feel a bit drowsy in the morning so be aware of that because sleeping pills can sometimes cause daytime drowsiness as well.
Usually though drinking some coffee or washing my face with warm water helps wake me up.