He was forced to miss some of the celebrations for his wife's 60 years on the throne after he was admitted to the King Edward VII Hospital in London the day after braving the elements on a barge for several hours.
Philip also underwent a successful procedure to clear a blocked coronary artery last December and was in hospital for four nights over Christmas.
Before the heart scare he had been fit and apparently healthy, and led the active life of a man of younger years.
In March this year his grandson Prince Harry said the operation had given him "a new spurt of life".
Philip went to Balmoral after attending a number of Olympic events. He was at the Queen's side during the Opening Ceremony on July 27 and the following day when they toured the Olympic Park.
He then watched his granddaughter Zara Phillips' Olympic equestrian debut on July 29 and was at the ExCeL exhibition centre a few days later to watch boxing.
The duke also appeared to be in good spirits as he watched yacht racing events on the Isle of Wight earlier this week.
-AAP