The purpose of meditation is to experience profound inner peace and happiness, so that you can let your bad habits and mental afflictions go.
As Thanissaro Bhikku point out in one of his Dhamma talk, the reason people continue to engage in unskillful behaviors, is because they couldn't find an alternative source of happiness, so they continue to try to obtain it through greed, obtaining wealth immorally, illicit sex, drinking and drugs. Experiencing the joy and peace that comes from meditation (and other mindful practice) provide a powerful alternative. You can't give up your bad habits unless you have something better to fall back on.
Here's the scriptural basis:
"Excellent, Sariputta. Excellent. When a disciple of the noble ones enters & remains in seclusion & rapture, there are five possibilities that do not exist at that time: The pain & distress dependent on sensuality do not exist at that time. The pleasure & joy dependent on sensuality do not exist at that time. The pain & distress dependent on what is unskillful do not exist at that time. The pleasure & joy dependent on what is unskillful do not exist at that time. The pain & distress dependent on what is skillful do not exist at that time. When a disciple of the noble ones enters & remains in seclusion & rapture, these five possibilities do not exist at that time.
http://www.accesstoinsight.org/tipitaka/an/an05/an05.176.than.html
The popular Ajahn Brahm frequently reminds people that the Jhanas are better than sex. In fact, it is accepted in Buddhism that the blameless pleasures of Jhana are better than any worldly pleasures. Now I have personally not been able to reach in that deep and cannot verify that claim, but I have experience the powerful benefits of the mental peace and joy that comes with meditation, and that alone is a powerful motivator to continue practicing.
When you encounter difficult situations you often find yourself unable to maintain that peace and joy however, but with practice you will begin to find yourself less likely to become irritated and annoyed with problems you were routinely frustrated with before the practice. So you won't get better over night, but you will inevitably get better. And even if you fail to do so, you can at least pull yourself out of the annoyances rather than stewing in your mistakes the whole day.