We present the first numerical simulations that self-consistently follow the formation of dense molecular clouds in colliding flows. Our calculations include a time-dependent model for the H2 and CO chemistry that runs alongside a detailed treatment of the dominant heating and cooling processes in the ISM. We adopt initial conditions characteristic of the warm neutral medium and study two different flow velocities - a slow flow with v = 6.8 km/s and a fast flow with v = 13.6 km/s. The clouds formed by the collision of these flows form stars, with star formation beginning after 16 Myr in the case of the slower flow, but after only 4.4 Myr in the case of the faster flow. In both flows, the formation of CO-dominated regions occurs only around 2 Myr before the onset of star formation. Prior to this, the clouds produce very little emission in the J = 1 -> 0 transition line of CO, and would probably not be identified as molecular clouds in observational surveys. In contrast, our models show that H2-dominated regions can form much earlier, with the timing depending on the details of the flow. In the case of the slow flow, small pockets of gas become fully molecular around 10 Myr before star formation begins, while in the fast flow, the first H2-dominated regions occur around 3 Myr before the first prestellar cores form. Our results are consistent with models of molecular cloud formation in which the clouds are dominated by dark molecular gas for a considerable proportion of their assembly history.