Prince Philip set to resume public duties after op
The Duke of Edinburgh will be seen in public for the first time in two months when he visits the Royal Society of Edinburgh on 12 August.
Prince Philip, 92, had an operation on his abdomen in June and spent 11 nights at the private London Clinic.
A Buckingham Palace said the Queen's husband was making "good progress" and "in good spirits".
The prince will present medals at the independent educational charity before joining the Queen at Balmoral.
He was admitted to hospital on 6 June after attending a Buckingham Palace garden party.
An exploratory operation was carried out under general anaesthetic the following day, after which he was said to be "progressing satisfactorily".
Buckingham Palace has never revealed why the operation was carried out, but a spokesman said at the time that the surgery followed abdominal investigations, was pre-arranged and not an emergency.
The hospital admission meant Prince Philip missed the Trooping the Colour ceremony and events including the traditional Garter service at Windsor Castle and Royal Ascot.
The duke was last seen in public on 17 June when he walked out of the hospital in central London and was driven to Windsor Castle.
He will travel to Edinburgh from the Queen's Sandringham estate in Norfolk, where he has been recuperating.
Prince Philip is an honorary fellow of the Royal Society of Edinburgh, which was established in 1783 for the advancement of "learning and useful knowledge".
After the engagement he will join the Queen for their summer holiday at Balmoral, her private estate in the Scottish Highlands.
BBC Royal correspondent Peter Hunt says Prince Philip's only other confirmed public engagement is a visit to the Dersingham Bog Natural Nature Reserve, which is located on the Sandringham estate, on 30 September.