A day includes any train you take that is scheduled to depart from your boarding point between 00.00 and 23.59 on that day. You may travel as far into the next day as any train goes.
Any subsequent changes after midnight will require use of the next day on your pass.
For your trip to Stockholm, there shouldn’t be a problem. Every train you take before midnight is covered by the same travel day. It’s the theoretical time that counts, even with delays. So if you board the night train to Stockholm at 23h55 somewhere in Germany, it’ll only cost you one travel day.
For the return, if you change trains the day after in Germany, it’ll cost you two travel days. So you need to apply a little trick to stay in your two inbound/outbound days:
Register the trip from Stockholm to Padborg (just before the German border). And then (it’ll be an ordinary travel day) when you board the night train in Stockholm, and not a inbound/outbound day. In the early morning, you leave from Padborg to Ulm (probably involving some changes), this will trigger a travel day and then only your inbound/outbound day. But this way you’re sure to only use two inbound/outbound days.
(You don’t have to switch trains in Padborg btw, just stay on the train you reserved, but register it in two steps in the app).
If you register it in one go from Stockholm to Ulm, It’ll cost you two travel days and and try to make use of a 3rd country day, which you don’t have.
Oh thats a good advice with Padborg and the App Handling. Thank you :)
Here's the information from Interrail about how to handle your trip back to Germany. We here in Sweden have the same problem travelling back to Sweden from Germany.
https://www.interrail.eu/en/interrail-passes/interrail-mobile-pass/mobile-pass-faq/how-can-i-travel-back-home-by-night-train