Its usually a few days but not always
Last year I had a drug test for work and I had done about a gram a week and a half before that. Test results came back a positive for cocaine.
Never really figured out why it was still in me after a week in a half but oh well