As part of the immigration process, there will be a time where you will be asked to input your US travel history for the past X years. This can be incredibly difficult if you've been in and out of the country multiple times, but here's a quick way to find out directly from the source!
Every time you enter the country or exit the country, somebody takes a note of it.
It's important to know this because when you're signing up for a visa, you may be asked for the last 5, 10, or 25 years of entries and exits, and for many over varying passports, this is nearly impossible to recall.
But here's how you go about getting the data. First, about your I-94 (it's relevant, I promise).
Finding your I-94 date
When you enter the country, your passport is stamped and information is entered digitally to attach to your immigration status.
There is a permit-until date (I-94) which is one of the most important dates you can possibly have in the U.S. so be sure to check it regularly, at least every time you re-enter the country.
Sometimes data is not inputted correctly, and you never want to overstay the date, so it's important to correct any mistakes before it becomes a Federal Legal issue.
Getting your US travel history
Step 2: Click the top link to “Get Most Recent I-94” (I know there's a link directly to “View Travel History” but as I said above, it's really important you check your I-94
Step 3: Read the Security Notification, and if you consent, push the blue “Consent & Continue” button
Step 4: Enter your traveler info (this is a legitimate government site, so you're all good and safe – good checking out though)
Step 5: Push NEXT
Step 6: Review your I-94 “Admit Until Date”
Step 7 (once you know you're in the country legally): Push “Get this Traveler's Travel History”
Step 8: Behold the master list!
It should have everything you need for that passport number, and you can put in old passport details if you want that information too.
A very important addendum
I want to add a big caveat to all of this. This record, while directly from the US Government, may not contain every entry and exit. If a border officer doesn't do things properly, or for some other reason the data isn't provided, there may be dates that you know, that aren't in the system.
For that reason, if you do remember that there is another entry/exit date that is not on this list, be sure to include it. While we can assume that data doesn't exist anywhere, you are asked in most forms to make a true and accurate report of your information, and therefore you might need to add some extras!