According to the TRIPS Agreement, a country belonging to the World Trade Organization (WTO) must grant a patent at least a 20-year term from the earliest filing date of the application. TRIPS came into effect in 1995 in the industrialized member countries, in 2000 for most of the rest of the member countries and in 2005 for least developed member countries. In some countries this has meant changing the rules, and patent applications filed under the previous rules may be allowed according to those rules. For example, in the US, the previous rules were 17 years from the date of issue, so a patent application that had a long time between earliest filing date and issue could be in force for much longer than 20 years from the filing date.
The 20-year term is valid as long as the maintenance fees for a patent are paid. Many patents lapse before the end of the term of validity because the owners fail to pay or decide not to pay the maintenance fees. It is a good idea to check whether a patent you are concerned about is still in force.