The length of time you should mix your saltwater before using it depends on the exact brand. Not all artificial seawater mixes are formulated the same and each brand will have specific instructions for the correct amount of mixing time.  In any case, it is important for all of the salt mixes to be dissolved and mixed to the proper salinity level before being used in your aquarium. It is possible to undermix salt and it is also possible to mix salt for too long so adhering to those manufacturer instructions really is critical for the best results.  

Best Practice vs Specialty Mixes

Most saltwater is mixed using the same process.  Using a large container, the salt mix is slowly added to a full container of RO/DI water and mixed using a powerhead. The amount of dry salt to use is indicated by the manufacturer but should always be verified using a refractometer or salinity meter. A heater can be added to bring the water up to suitable aquarium temperatures and the saltwater is left to mix for 24 hours to ensure everything is dissolved.  This is the process that a majority of us will use to mix our saltwater but there are a few specialty salt mixes that require things to be done a little differently. 

For example, Red Sea Coral Pro has elevated levels of calcium and alkalinity that will actually precipitate out of the solution if left to mix for too long; Red Sea recommends you only mix this particular salt mix for 4 hours.  E.S.V. B-Ionic Seawater Mix has multiple components that are added to the water separately and it is important to follow those mixing instructions precisely.  

In any case, no matter the kind of salt mix you choose, just follow the manufacturer-recommended mixing times for the best results. Also, choose a salt mix that accommodates your particular maintenance routine.  For example, if storing saltwater for 2-3 weeks is your plan, the Red Sea Coral Pro is probably not the best option to avoid that precipitation we described.