You do not need to stay in Amsterdam for any period before consuming cannabis. Dutch policy tolerates possession/use in licensed "coffee shops" for adults 18+ with a limit of 5 grams. Possession, production, and sale remain technically illegal but are decriminalized under these conditions.