It varies depending on your state laws and the amount of alcohol/ drugs in your system. In general, the maximum detection time for most routine DUI test is 12 hours. However, for extreme cases of heavy inhalation of smoke, it may be present up to 72 hours after use. It is important to note that having any amount of a controlled substance in your system while driving can result in a DUI charge, regardless of when it was consumed. It is always safest to wait until the effects of any substances have worn off before getting behind the wheel.