A long, long time. Since you hair grows so slowly, they can tell how long ago you used, what it was, and if you have stopped using.
The standard test, as you can see here:
http://www.craigmedical.com/Hair_Drug-Test_FAQ.htm
Generally only test for the past 3 months though, but they can test further is they wish or deem it necessary to establish a pattern.
verwon@gmail.com
My information is not guaranteed correct. I do not get them right all the time, but I do enjoy the hunt~