How is the duration of the 240-hour visa-free transit calculated?
english.shanghai.gov.cn
A: The border inspection station will issue you a temporary entry permit, and the visa-free transit is calculated from 12 am of the next day upon arrival. You can make cross-province travels within the allowed areas for visa-free transit travelers in 24 provinces (autonomous regions and municipalities) for up to 240 hours.
Source: Shanghai Exit-Entry Border Inspection General Station