How do I reduce the length on the Time Ruler in order to make the composition shorter in duration?
There's no built - in function that does it, but there's a script for that. I wrote one called first-n-last, it's available (free, open source) here https://blob.pureandapplied.com.au/
Alternatively, park your playhead at the beginning of the first layer (select that layer and hit i), then set the start of the work area to that frame by hitting b then select the last layer and hit go to the last frame (hit o) and set the end of the work area to that frame by hitting n. Now right click the work area and choose trim comp to work area from the contextual menu. This doesn't work for layers that extend beyond the beginning or end of the comp, but my srcipt does.