This all depends on what precisely triggered the original check engine light. There are literally hundreds of items that can cause a check engine light.
One of the jobs of the ECU (Engine Control Unit) is to monitor the data received from all of the various sensors connected to the engine, transmission, and exhaust. The ECU is programmed with all of the high and low parameters from all of these sensors. If a sensor gives data that is out of the expected range, the ECU will store a trouble code and turn on the check engine light.
Most times the ECU will now consider data from that sensor as bad and use a pre-programmed static value to keep the engine running.
Sometimes the ECU will clear the code by itself if the bad data is not read over a preset number of engine run cycles. This way temporary events will clear automatically.
As an example under a heavy engine load, the oxygen sensor may read out of range. The oxygen sensor would not necessarily be bad. This would only be a temporary condition and if the car is driven normally, the code would eventually automatically reset.
Another example would be if you forgot to tighten your gas cap. A fault would be detected with Evaporative Vapor system. Tighten the gas cap and in a day or so, the check engine light goes out on its own.
This is not a timed interval item. The light comes on when something is wrong.
There are dozens of sensors connected to a modern computer controlled vehicle. The best way to find out what is wrong is to extract the diagnostic trouble codes from the computer with a scan tool. Fortunately, most major automotive parts stores will do this service for you for free. I like free.
The information that you get from this service will vary depending on the individual parts store and the skill level of the person extracting the codes. Sometimes you will get a detailed report with explanations and recommendations for each code discovered in the computer. Other times all you get is the trouble codes. However, you can use your favorite Internet search page to research these diagnostic codes.
What you do with this information is up to you. If you are mechanically inclined, you can attempt a repair yourself. It may be something as simple as a loose or missing gas cap. If making your own repairs are beyond your skill level you will at least have a good idea of what your mechanic should be doing to your vehicle to make the repairs.
If you decide to start replacing parts yourself based on these diagnostic trouble codes do not replace any component without bench testing the part first. Most of the various sensors connected to the engine have bench test procedures. Do a little research on the Internet and you should be able to find these component bench test procedures for most of these parts. Many times your local automotive parts store can also bench test these components. Do not buy any replacement parts unless they fail bench testing and you are confident they are faulty. This will save you lot of money by not replacing good parts. It will also save you time and frustration as you will not be replacing good parts and not solving your problem.