You can book tickets till the time of chart preparation for the train, which is normally 4 hours before the scheduled departure of the train from the train originating station. For trains which start before 12 noon, the chart preparation is usually done on the previous night.