One should stay out out in the open immediately after an earthquake. Ideally, one should wait for the aftershocks to subside. But aftershocks can last for days or weeks. If the damage after the main shock was heavy, the site is more likely to experience additional damage from the aftershocks. A main shock large enough to cause damage will probably be followed by several aftershocks within the first hour.
Aftershocks decrease in number and magnitude over time.
Generally speaking, the second day will have approximately half the number of aftershocks as the first day and one-tenth as many on the tenth day. Except for life-saving rescues, entry into seriously damaged buildings should be avoided during the first 24 hours following a main shock. If you have to enter a damaged building, the stay must be very, very brief. Five more days should elapse before the building is occupied for fixed periods of time. You must get a structural engineer to visit the building and assess the damage.