We propose and demonstrate a reconfigurable all-optical format conversion from optical time-division multiplexing (OTDM) to wavelength division multiplexing (WDM) providing full flexibility in terms of channel spacing and wavelength allocation. The system consists of a Raman amplification-based multiwavelength pulse compressor and a parametric sampling gate. Four conventionally generated WDM 10 GHz pulse trains are compressed at the same time to around 2.5 ps and, then, used for multiwavelength sampling of a 40 Gb/s 3.49 ps OTDM signal. Simultaneous extraction of all four 10 Gb/s tributaries to WDM channels in WDM grid with tunable channel spacing is demonstrated. Controlling time delays among the WDM clock channels makes it flexible to map OTDM tributaries onto any desired wavelength order, which is also called wavelength- and time-selective function. The reconfigurable functions can be realized independently on the coming OTDM signal by simply setting corresponding parameters of the WDM synchronous pulse trains at the terminals. This is also the key for the good overall performance obtained for all demultiplexed channels. Low power penalties below 1.9 and 2.1 dB are achieved with small penalty variations, 0.3 and 0.5 dB, among channels as the OTDM tributaries are converted to WDM grid with spacing of 400 and 200 GHz, respectively.