In theory as long as your battery holds out.
Set it to bulb mode (set to manual, increase shutter speed til it reaches 'B'). Your shutter will remain open as long as the button is held down*, so get a remote release unless you want a very sore finger.
*I think some cameras limit this to 30 minutes. Is that long enough for what you want to do?