Roger Federer has a little fun with Trevor Noah and shares that Rafael Nadal might be better than him at trick shots. (1:07)

Roger Federer has announced he will miss the French Open following surgery on his right knee.

Federer, 38, underwent surgery in Switzerland on Wednesday and announced via Twitter that he will be out until the grass season.

"My right knee has been bothering me for a little while," Federer said in his tweet. "I hoped it would go away, but after an examination, and discussion with my team, I decided to have arthroscopic surgery in Switzerland yesterday [Wednesday].

"After the procedure, the doctors confirmed that it was the right thing to have done and are very confident of a full recovery.

"As a result, I will unfortunately have to miss Dubai, Indian Wells, Bogota, Miami and the French Open.

"I am grateful for everyone's support. I can't wait to be back playing soon, see you on the grass!"

The timeline means Federer will target Wimbledon as he aims for his 21st Grand Slam title, but will miss Roland Garros, which takes place May 24-June 7. His sole French Open triumph came in 2009. Novak Djokovic, the eventual champion, knocked Federer out of last month's Australian Open in the semifinals.