compression socks question

💔
When do you wear them for the swelling? When your on your feet? When your resting? When you sleep? My doctor recommended getting them, but didn't mention when to actually wear them