Idk if it's the best way, but I usually do a task that I enjoy or at least will keep me occupied.
Bad day ? There's sports, walking in a parc, playing (Minecraft) or my personal favorite : coding.
If you feel really bad about something specific and you're too down to work on the problem, don't panic.
Some problem needs patience and rest, so uh, you need to find a way to keep your mind occupied, because this machine ain't stopping.
TLDR : feeling in a bad mood ?
1- try to find why and address it
2- if you can't find why or can't address it, find a task to occupy your mind, so you feel better
3 - back to step 1