I had some prior experience as a hobbiest, mostly messing with BASIC as a kid, but with no formal structure. I majored in music and after a bunch of wasted years in dead-end jobs, became a professional programmer after only 3 months self-study while on unemployment. So depending on your background and passion and luck, a year or two can be plenty. There are several other stories floating out there, like the blacksmith who became a Rails web dev after I think it was one year of study.