I am interested to know for provisional and nonprovisional patent applications submitted to the USPTO.
If you use their web-based system it is the instant you push submit. It’s an awkward user interface but they have started charging an extra fee for using paper.
If you follow the rules regarding paper filling and include a self addressed post card they will stamp the application number on it when they open the envelope and mail it back.
Without the postcard you might not have a good way to communicate with them for a long time. If you call and ask about it there may be difficulties in establishing that you are the applicant. They don’t talk to random people about applications. If you know the date of mailing and the title you might be able to ask them the application number.