This will depend on your destination of travel. Some countries allow you to take a test up to 72 hours before your flight, however, some are shorter. For the most up to date information please visit https://www.gov.uk/foreign-travel-advice.