This is tricky because I use my phone to play music and check off my fabulous tasks for the day. I typically turn off the wifi on my phone as soon as i start my bed time routine. I also downloaded a wifi timer app that turns off my wifi at certain times. Each night my wifi turns off at midnight, 12:30, 1am, 1:20, and 1:30. That way if i turn the wifi back on for any reason it shuts right back down, so i don't stay up late watching animal videos on youtube.
TLDR: disconnect as soon as you begin your night time ritual, and then make sure you stay disconnected with timers and apps.
I disconnect about an hour before I intend to go to bed, at the point where all of my remaining activities are focused on self care and preparation for sleep. At that point, I don't want to be distracted, drawn into a new task, or stimulated.
5:00 pm is the best time for disconnect I think. Because at or around this time many of us completes the daily chorus and have a nice cup of tea to chill and refresh.