I can write a song, when the inspiration hits me, in six minutes. To learn a song well enough to perform it without stumbling takes a good deal longer--a day, or three, and sometimes a week. Some songs are harder to lay down in memory than others--the ones with more subtle melodies and less clichéd lyrics require more focus.
A