Record of Entries to Canada or USA
Both Canada and the US keep a record of every time any person enters the country. This is true for land and sea borders, as well as airports.
Currently, Canada only maintains records of entries. However, the US keeps records of every single person's entry and exit from the country.
If you're not sure when you entered Canada or the US, you can obtain these records. Many people use the records to support their applications for Canadian citizenship, pension, or a PR card.
CBSA Record of Movement (Canada)
When you pass through the Canadian border, the CBSA (Canada Border Services Agency) officer will scan your passport and, if you are a permanent resident rather than a Canadian citizen, your PR card.
This record of your entry is recorded in a database and is never destroyed.
Records are kept for every nationality including Canadian ciitzens.
You can obtain CBSA records going back many decades into the early 20th century.
FOIA Request (USA)
Every time you cross the US border, a record is created of your entry or exit by US Customs and Border Patrol. There is a record of you entering the United States even if the officer does not stamp your passport.
These records are created for people of every nationality, including American and Canadian citizens, and they are maintained indefinitely.
You can request a copy of these records for a certain period of time going back several decades.