You can safely hold your urine in for up to 12 hours especially during the night when you're sleeping.
But although you can hold your urine in for 12 hours you should always relieve yourself before then if possible during the day to avoid any bladder infections or even kidney disease.
Never hold your pee in when there's no good reason too.