Ideally baby and bridal showers are held 1-2 months before the big event, be it a birth or a wedding. However, do take into count other events that may be going on at the same time and choose a date that works best for the guest of honor and the majority of her invitees.
The duration of a shower should be about 2-3 hours. Feel free to include a start and end time on the invitations to communicate this to your guests. As a hostess though, be prepared for the shower to last a little longer than your anticipated end time, as people chat and slowly make their exit.
The timing of a shower can make or break the experience. Although 2-3 hours may be customary, take into account your guest list and planned activities. Showers shouldn't be a rushed affair but you don't want your guests to feel like captives either :)