The nice thing about melatonin is that it's not addictive. About three days, and the body finds its pattern. As the article mentioned, fasting during the correct times would work but that + a low dosage of melatonin 30 minutes before the desired bedtime would probably work even better.
Something important to note is that melatonin is not going to force you to sleep. You're not going to fall asleep staring at a computer screen if you take a dose of melatonin. It will make you sufficiently tired to sleep if you lie down and close your eyes for a bit, but it's not going to overcome the awareness-brainhack that is staring at bright light.