I had that problem myself recently and I knew someone that was also having the same problem. It was worse for me because my garage door faces south and gets a lot of direct sunlight throughout the day.
The problem is the infrared safety sensors which sit at the base of the tracks that prevent the door from closing when there's something in the door opening can get somewhat blinded if there's too much sunlight. At night or on overcast days the garage door opener works perfectly, but on bright, sunny days I'd have to get out of my car and hold down the button the keypad to force the door to close.
I searched the internet to try to find a solution to the problem and most people recommended adding some sort of devices to cast shade on the sensors. This didn't make a lot of sense to me. The sensors are installed behind the walls and there was no direct sunlight being cast on them. If for some reason you do have direct sunlight on your sensors then that's something you can try. The fix I found was much simpler.
When I finished installing my garage door opener one weekend it was dark out. I aligned the sensors and it worked fine. The next day it was very sunny and the door wouldn't close.
After a few days of problems I tried to re-align the sensors while the sun was out. Once I had the sensors optimally aligned during the sunniest part of the day the garage door opener has been working perfectly.
If you're having the same problem, try to re-align your garage door opener's safety sensors. When the sensors are properly aligned an LED on each should light up.