We propose a novel reconfigurable time domain spectral phase encoding (SPE) scheme for coherent optical code-division-multiple-access application. In the proposed scheme, the ultra-short optical pulse is stretched by dispersive device and the SPE is done in time domain using high speed phase modulator. The time domain SPE scheme is robust to wavelength drift of the light source and is very flexible and compatible with the fiber optical system. Proof-of-principle experiments of encoding with 16-chip, 20 GHz/chip binary-phase-shift-keying codes and 1.25 Gbps data transmission have been successfully demonstrated together with an arrayed-wave-guide decoder.