It can but it is expensive. More often they will just test for the presence of a drug. They will then know approximately when you used the drug depending on the type of test eg blood or urine.
Urine 2-4 days,saliva up to 3 days,hair for years