You should take melatonin before you go to bed. It is recommended to take it approximately 1 hour beforehand. Only take melatonin when you are at home, as driving afterwards is not recommended.