Between 20 minutes and 6 months.
If that's infuriatingly vague (I know it is!), here's a wee breakdown: I usually capture the melodic idea for a song (verse & chorus) in 5-10 mins. Then I'll spend anything from a few hours to a couple of weeks (sometimes more) getting the arrangement right, fiddling with the melodic details (phrasing and such) and writing a bridge/ other section.
Lyrics are the hard work for me. I'm really particular about how they feel to sing, and of course what the song is saying. I can spend anywhere from a couple of days to 6 weeks on the lyrics. Sometimes I'll finish the lyrics, but after singing the song in public a few times I'll realise it's not working (songs feel different when you play them to strangers) so I'll come back and fix them sometimes months later.
Once in a blue moon a song will fall out of me fully formed in the aforementioned 20 minutes. I'm very happy when that happens!
What about you?