Depends on what you want to ride and the main reason for going to the parks. If you are only really going for Harry Potter then one day is enough and you need a park hopper to ride the train.
If you want to ride everything and go back and re-ride a couple of things then you need two days.
Last trip we had two days with hopper and did two half days at each park starting in a different park each day so that we got to experience the train in both directions (so Monday we did IoA then Uni and Tuesday Uni then IoA). Then around 5pm we left the park to go shopping.