It’s genetics. Here is a clear explanation that is not too technical, excerpt below: “Around a hundred years ago, people realised that plants are able to gauge the length of the day via their green leaves, causing the shoots to form flower buds. In other words, some kind of signal must go from the leaves to the tips of the shoots, though the exact nature of this signal was a mystery. In May 2005, a Swedish researcher, Ove Nilsson discovered the mechanism: We discovered that the genes that determine when flowering occurs are active in the leaves, not in the tips of the shoots where the actual flower opens. The gene that we found produces signal molecules that are conveyed from the leaves to the tips of the shoots, where they control the formation of proteins that in turn are responsible for the actual flowering.” This signal molecule is neither a sugar molecule nor a protein, but a type of messenger RNA (mRNA), a tiny piece of the genetic material that controls the formation of proteins. The point in time at which flowering occurs is thus pre-programmed in plants’ genetic code in the same way as when humans and other animals reach sexual maturity.”