Depending on what caused the diarrhea the time it takes to go away can vary.
Most cases of diarrhea go away within a few hours to 3 days but sometimes if the diarrhea is more severe it can last up to a week.
If the diarrhea doesn't go away within a week then you should see your doctor or go to urgent care because diarrhea can dehydrate you if not treated.
Make sure you stay hydrated by drinking water or juice or even some pedialyte to help replace lost electrolytes while you're experiencing the diarrhea.
You can even buy some diarrhea medication over the counter that helps stop diarrhea.