To maximise the grain yield of spring wheat, flowering needs to coincide with the optimal flowering period (OFP) by minimising frost and heat stress on reproductive development. This global study conducted a comprehensive modelling analysis of genotype, environment and management to identify the OFPs for sites in irrigated mega-environments (MEs) of spring wheat where the crop matures during a period of increasing temperatures. We used a gene-based phenology model to conduct long-term simulation analysis with parameterised genotypes to identify OFPs and optimal sowing dates for sites in irrigated MEs, considering the impacts of frost and heat stress on yield. The validation results showed that the gene-based model accurately predicted wheat heading dates across global wheat environments. The long-term simulations indicated that frost and heat stress significantly advanced or delayed OFPs and shrank the durations of OFPs in irrigated MEs when compared to OFPs where the model excluded frost and heat stress impacts. The simulation results (incorporating frost and heat penalties on yield) also showed that earlier flowering generally resulted in higher yields, and early sowing dates and/or early flowering genotypes were suggested to achieve early flowering. These results provided an interpretation of the regulation of wheat flowering to OFP by the selection of sowing date and cultivar to achieve higher yields in irrigated MEs.