The best time to take melatonin will depend on the nature of the sleep problem:
Sleeping pills for insomnia: A person with insomnia should take a sleeping aid, which includes valerian and sedative antihistamines, just before or at bedtime.
Sleeping pills for jet lag: Melatonin is a good option if tackling jet lag. Take melatonin several hours before the intended bedtime every day throughout the trip and a few days afterward.
Sleeping pills for shift work: Melatonin may also be the best option for people managing shift work. Taking melatonin at the end of a shift can help prepare the body for bed.
People taking sedating antihistamines should follow the directions on the medication or the advice of a medical professional.
When to take valerian depends on the type a person uses. Generally, people can take valerian an hour before going to bed. People should follow the recommended dosage for supplements.