I usually can tell I'm having one of those days early on in the day so I adjust expectations. My todo list is halved and what remains gets broken down as small as I can manage. Every checked off item is a little boost!
I also make sure to leave the office at lunch and walk. Sometimes that bit of exercise and being away from my computer helps change my mood.
If I'm really really reaaaaally unmotivated, I take the rest of the day off. It's probably a better use of my time and the company's money if I go home and nap, cook a good supper and take care of myself. The next day I'm usually ready to rumble!
I like the second advice, Being away from my computer or any electronic device, it really helps sometimes.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.