We can’t remember every moment of every experience, so we selectively remember the highlights and the last part. Then we categorize our memories based on the highlight and last part of the experience. A really good experience that ends poorly will be categorized as bad while a bad experience that ends well will be categorized as good. One year from now we will remember that in general the experience was good or bad based on the highlight and our last memory. This is mostly an unconscious process, but we can influence it, by purposely reviewing the good parts at the end of every experience.
Every night as you sit down on your bed, think through the day and remember the good things that happened that day. A month from now you will remember mostly good days and at the end of the year, you will believe you had a good year. Much of your happiness is based on your memories, and you can choose to focus on the bad memories and have a crummy life or focus on the good memories and have a great life.