A question about sailing ships

I have a question about sailing ships from the middle ages. Does anyone know how they handled being at sea for weeks or even months at a time?