Federer underwent the surgery to repair a torn meniscus sustained the day after his semi-final match at the Australian Open, according to Tony Godsick.
As a result of the surgery, Federer will now miss the ATP tournaments in Rotterdam and Dubai this month.
"I am so disappointed to have to miss Rotterdam and Dubai as they are two of my favourite tournaments on the ATP World Tour," Federer said.
"While this is an unfortunate setback, I feel grateful that up until now I have remained mostly healthy throughout my career. My doctors have assured me that the surgery was a success and with proper rehabilitation, I will be able to return to the Tour soon."
More From This Section
Federer hasn't beaten the runaway world number one at a major since the Wimbledon semi-finals in 2012, when he last won a Grand Slam title.
Unlike great rival Rafael Nadal, Federer has enjoyed a relatively injury-free career, the exception being bouts of recurring back pain.
The last time that happened was at the 2014 ATP World Tour Finals in London when he withdrew at the last minute from the final against Djokovic.
Federer will now aim at being fit in time for the first two Masters Series tournaments of the year at Indian Wells and Miami in March.
After that the season switches to clay and the build-up for the French Open, the second of the year's Grand Slam tournaments. Federer's only title in Paris came in 2009.