Yes, your can recapture the days you spent outside of U.S. when it's tme to
extend the H1B. You need to maintain good record of your travel. Typically
the stamps in your passport will serve as evidence of in and out of the
country. Keep your airline ticket receipt/boarding passes too in case they
can be used as secondary evidence.