score:4
Ask you local (i.e. journey origin and all transit points, especially the one with direct flight to China) embassy or consulate before departure as the code approval is their responsibility and they have discretions.
From Switzerland, a sample taken within 48 hours before departure is required; but from experience minor discrepancies are sometimes also accepted. For the USA, it is also 48 hours, but some consulates are strict and will not accept any delay.
For the UK, the day (local time) is what counts.
Do not rely on IATA alone for Mainland China. The HDC is not a certification of test results alone. Many consulates are not issuing health codes to transit passengers (with certain exceptions) or for travels they deem unnecessary (and they can impose requirements without prior notice depending on the situations in the departure area and China). Additionally, many have a list of designated laboratories and refuse to accept results from other institutions. The requirements also change fast (on average probably once a month) so you must navigate through the rather confusing embassy sites for the latest information or ask them directly.