Some aviation agencies have not approved melatonin.
Generally all medications even over the counter ones, when used for flying the guide line is not to be taken within DOUBLE the effective period. So if you want to use an 8 hour lasting cough suppressant, you can't do it less than 16 hours before flying.
Just because something is over the counter does not mean you can take it and go fly a jet.
Furthermore, the results on melatonin vary from person to person and doesn't seam to last even if it did work for you initially... (hope I didn't just destroy a placebo effect for you)
Cheers
Wino