Could by any time from the moment after you book until departure (which might be a delay due to a swap).
Even without mechanical and other issues, carriers maximize the efficiency of their fleet. If the economy perks up at one location, it may make sense to swap larger aircraft onto a route and to substitute the smaller aircraft into the unexpectedly poorly-performing route.