well, you're probably going to hate this answer, but here goes: it depends.
some people's piercings heal faster than others (depends on the person, depends on how well they were pierced). so we can't give you an exact date. a week at least.
but for basketball, be careful. i played sports, too and i have ear piecings. you can take an earring out before a game just fine. but you can't take out your belly button ring (it'll close up before the second half). piercings can be dangerous during sports. they get snagged, ripped and torn. OUCH! some refs won't even let you onto the court if you have a piercing without covering it with a piece of athletic tape or something.
as for swimming, definitely let it heal up all the way (don't skimp on healing time here. if it's healed, you'll know it's healed. if it's still sore and still resembles a fresh wound, don't swim. when you do go swimming, when you're done, dry it off immediately to keep the piercing for festering in water (a great way to get an infection).
oh, don't even po-mo me, baby...