Taken from
CAA
In the light of what is now known about melatonin, its use by flight and cabin crew is not recommended. Because melatonin will cause sleepiness and impair performance immediately after ingestion, and because the after-effects could be detrimental to operational efficiency, the use of this compound less than 12 hours before the start of a flying duty period and on board an aircraft should be forbidden.
Try Google for "CAA Melatonin" and related searches.
If you're going to use it, best make sure you're not working for a while...
BTW, I do know people who swear by Melatonin, but they're not professional pilots... There are also other risks to be aware of, so Google is your friend in this instance.