How to get him off the bottle

LO is 18 months old and has a formula bottle before nap time and before bedtime. Sometimes he wakes up at night -usually twice because he’s thirsty and diaper really full with pee. I’ve tried offering water once at night, he was angry and would refuse.

How to slowly get rid off the bottle? Do I stop the bottle before nap time first? Offer water at night even though he refuses? Help