The police can hold and detain you for up to 24 hours in jail without charging you with a crime but they must charge you with a crime to hold you in jail longer than 24 hours and then they have to release you if they don't charge you with a crime.
As for on the streets if a police officer detains you they usually either charge you with a crime or release you within 15 to 30 minutes.
Always ask the police if you're being detained or you're free to leave because sometimes they're just keeping you there to try and find something to charge you with without you being detained.