A metalcore/thrash/progressive/tech death/melodic death song?
To learn, about an hour maybe? To play cleanly and at tempo, a couple weeks.
How long is a piece of string? It depends completely on the complexity of the song - anything from playing it directly off the sheet music at first sight, to several years. The biggest variable is whether you have to increase your core skill level in order to pull it off cleanly at tempo, or whether it's just learning and a bit of clean up.
If its a song that requires techniques and skills I already have, then a week tops or so to memorize and clean up. If its something I have to learn a technique from, or a song I could already play but is overly complex, it can take from weeks to months, even years. I learned the guitar wanting to play Classical Gas, first song I ever tried to play... 1 year and a half later I knew a bunch of other songs and I just mastered Classical Gas, took me a while to learn that one :P