ncks -d time,start_time,end_time in.nc out.nc
start_time and end_time are integers.
Add -F, if you want to use Fortran indexing (to start from 1).
No space between dimension name and start-end points!
The NCO (netCDF Operator) command ncks (netCDF Kitchen Sink).
From the documentation:
The nickname “kitchen sink” is a catch-all because ncks combines most features of ncdump and nccopy with extra features to extract, hyperslab, multi-slab, sub-set, and translate into one versatile utility. ncks extracts (a subset of the) data from input-file and and writes (or pastes) it in netCDF format to output-file, and optionally writes it in flat binary format to binary-file, and optionally prints it to screen.