How would you encode a feature that represents cyclical data like day-of-week or hour-of-day?

In data science, cyclical features like day-of-week or hour-of-day require special treatment because their values wrap around — for…