Directly from travel.state.gov
A: If a trip is shorter than 3 days, a viral test taken in the United States can be used to fulfill the requirements of the Order as long as the specimen was taken no more than 3 days before the return flight to the US departs.