From my experience it takes about three days give or take the nature of your surgery, your age and possibly your upbringing. Definitely your sex. When Norman (yes, in Australia we have mixed sex wards. I’m sure the logic of this came from a committee of bureaucrats with no experience in a health-related field but charged with the responsibility to reduce hospital waiting-lists due to a recent election promise) let rip the most impressive, in length and tone, fart on my first full day on the ward as I waited for my unexpected and some would therefore say emergency spinal surgery it took a lot of concentration and ten-fold in willpower not to laugh.
The funny wears off, slipping fast to repulsion and thereafter benign resignation.
From that golden age we realise we fart and that not only can it sound AWESOME but smell SO FOUL we learn it is something truly only to be enjoyed at home and, if you’re male or me, shared in the company of those you love.
So to come to an environment where the public expulsion of air, with NO regard to if it may or may not be odoriferous, can be quite a shock. Prime factors which change that are pain and opiates. I’d say duration of stay may bring you full circle but while they’re handing you the pills and asking if you’ve passed wind or opened your bowels today, as Norman lets one rip loud and long enough for all of you, just nod and go back to sleep.