Well, the program has to be offered in computer format. Other than that, it depends on how fast you can take the classes. Not all degree fields are available totally over the computer, and you also have to make sure that the degree comes from a properly accredited and accepted source. And concerning time, if the classes aren't semester based, but are, instead, finished whenever you finish them, then the amount of time needed depends on how fast you get done. But if it is just a regular course offered online every semester, then no, you can't get done in two years unless you take double the amount of classes each semester---which is crazy. That's like 36 credit hours a semester.
_________________
Superman wears Jack Bauer pajamas.