There are ways of creating oxygen onboard submarines. The only real limits to time submerged is the amount of food the boat can carry.
Here is a video by Destin from the Smarter Every Day youtube channel explaining oxygen generation onboard submarines. https://youtu.be/g3Ud6mHdhlQ
Should have been in front of a firing squad.