Marijuana is a fairly short-term drug. It is only going to decrease your ability to drive for about three hours, which may not even be as long as a night of drinking alcohol would. Typically, experts agree that the effects wear off in an hour or two. In some specific cases, minor effects can linger for a day, but it's not as if you are experiencing the full impact of the drug for 24 hours.
Do not make the mistake of thinking that no one can find out you used marijuana after one to three hours, however. Even if the effects wear off, it can still show up in your system.
The issue that you face is that the metabolites from THC are very slowly eliminated, especially if they wind up getting stored in fat cells. The half-life is about 20 hours. It usually takes anywhere from 10 to 13 days for them to be depleted so far that they cannot be detected.
Generally, researchers say that even a simple urine test can tell if you used the drug in the last 13 days. That means that, after you smoke or otherwise consume marijuana, you have roughly two weeks in which you could fail a drug test.
To some degree, it does matter how often you use it. Many people say that one-time use typically fades faster, that it can't be detected in about a week -- anywhere from five days to eight days.
Regardless, all of these estimates are vastly longer than the few hours that you may feel the effects of marijuana. If you do get arrested on drug charges, make sure you know all of your legal defense options.
Source: Very Well Mind, "How Long Does Marijuana Stay in Your System?," Richard N. Fogoros, accessed June 15, 2018