Most will have a mandatory evaluation period of your stay... around here that's 72 hours... so once you're in you're in for 3 days no matter what even if it's voluntary. But, past that, unless you're suicidal or homicidal you can leave at any time. However, before that 72 period you can opt out at any time. It's voluntary that you are there for the 72 hours, but not during that period.
Anyway, if you come in for any reason you can expect to be there the entire 72 hour period as I've never seen anyone release earlier than that. For that time, yeah, you will be in the same rules as people who are involuntarily committed, but you agree to that before you even come in. However, that shouldn't deter anyone -- if your problem is serious enough don't mess around these things got a way of getting out of hand.