3 months. Maybe 6 months.
On drums, within the first 4 lessons, one should be able to play along a bunch of songs.
On piano, depending on the style of music, a month of moderate practice would give the player the chord progression of a few tunes, maybe even the basis of improvisation and enough independence to create your first melodic lines.
But, of course, the question is biased because everyone has a different idea of what learning the drums or the piano means. Some sees it as just barely being able to pluck a few notes, while others, more ambitious, want to give life to a symphony of sounds. Those drastically different visions will be tied to drastically different timetables and drastically different efforts.
So, what do I recommend? What is important in the question? I see it this way: Fun! That’s what is important. If you’re always willing to find the fun in learning music, you will have a better chance of doing it for a long time and actually becoming good at it, than if you think of it as a chore.
Asking the question : How long does it take to learn to play the drums or the piano? is like contemplating the mountain to climb and wanting to know how high it is. And my answer would be to not worry about the length of the journey but to encourage you to have fun while climbing. And here’s a secret from the pro: the top of that mountain doesn’t exist anyway.