  The classical equations of motion of Maxwell and Born-Infeld theories are
known to be invariant under a duality symmetry acting on the field strengths.
We implement the SL(2,Z) duality in these theories as linear but non-local
transformations on the potentials. We show that the action and the partition
function in the Hamiltonian formalism are modular invariant in any gauge. For
the Born-Infeld theory we find that the longitudinal part of the fields have to
be complexified.
