Where in the digestive tract are melatonin pills dissolved? Same question for gelatin capsules
Unless specially coated or formulated, most pills break apart in the stomach. Note: "break apart", not necessarily absorbed.

Take a gelatin capsule with rice or melatonin and immerse it in warm water. Massage gently with your fingers. Watch the clock. 

When the rice is fully exposed, or the melatonin starts to break apart and dissolve, add that amount of time to the instructions. Be sure to take it with at least 4 ounces of water.