You have only two things to worry about: either you're healthy or you're sick. If you're healthy, you have nothing to worry about. If you're sick, you have only two things to worry about: either you're going to get better or you're going to die. If you get better, you have nothing to worry about. If you die, you have only two things to worry about: either you're going to heaven or you're going to hell. If you go to heaven, you have nothing to worry about. If you got to hell, you'll be so busy greeting old friends you won't have time to worry.
Bonus points for expressing this saying in the most concise pseudocode.
Don't think about the past - Honestly when was the last time you learnt something by spending hours pondering the past
Don't think about the future - Future is always different from what you think it will be
It is about letting go really, once you can "Let Go" you are much happier a person
However, I think it's natural to think about the past and worry about the future. The key IMO is to do these productively, and not go about thinking or worrying just for their own sakes like a broken record.
If you're thinking about the past, think deliberately in order to distill any lesson you hope to learn from it. Write down these points somewhere, ala GTD style. And then put the past aside - you're done with it.
Similarly, worrying about the future can warn us about potential dangers. Worrying should cause us to ask specific questions such as "what's the worst that can happen?", "how am I prepared to face the worst, if it does happen?", "what steps can I take immediately to ensure that the worst does not happen?", etc. Once these are made clear in a list, take the worry entirely off your mind.
If you don't think about the past then how can you learn from previous mistakes? Or reflect on past happinesses?
If you don't think about the future, how will you know where you're headed, or check that you're progressing in the right direction?
I agree that removing past and future anxiety (ie - being in the present) will make you happier in what you're doing, but only to an extent. After a while, just doing day to day things without any sense of direction makes your feel like a drone. Or like an animal that knows just enough to feed, find shelter, etc.
"Doing" in the present is one thing, but dreaming from time to time about the bigger picture is equally important.
An example from Epicurus:
If thou wilt make a man happy, add not unto his riches
but take away from his desires.
Freedom is secured not by the fulfilling of one's
desires, but by the removal of desire.