The properties of a {ital d}{sub {ital x}}{sup 2}{minus}{ital y}{sup 2}-wave superconductor in an external magnetic field are investigated on the basis of Gorkov`s theory of weakly coupled superconductors. The Ginzburg-Landau (GL) equations, which govern the spatial variations of the order parameter and the supercurrent, are microscopically derived. The single vortex structure and surface problems in such a superconductor are studied using these equations. It is shown that the {ital d}-wave vortex structure is very different from the conventional {ital s}-wave vortex: the {ital s}-wave and {ital d}-wave components, with the opposite winding numbers, are found to coexist in the region near the vortex core. The supercurrent and local magnetic field around the vortex are calculated. Far away from the vortex core, both of them exhibit a fourfold symmetry, in contrast to an {ital s}-wave superconductor. The surface problem in a {ital d}-wave superconductor is also studied by solving the GL equations. The total order parameter near the surface is always a {ital real} combination of {ital s}- and {ital d}-wave components, which means that the proximity effect cannot induce a time-reversal symmetry-breaking state at the surface.