We study the effect of Joule heating from electric currents flowing through ferromagnetic nanowires on the temperature of the nanowires and on the temperature of the substrate on which the nanowires are grown. The spatial current density distribution, the associated heat generation, and diffusion of heat is simulated within the nanowire and the substrate. We study several different nanowire and constriction geometries as well as different substrates: (thin) silicon nitride membranes, (thick) silicon wafers, and (thick) diamond wafers. The spatially resolved increase in temperature as a function of time is computed.For effectively three-dimensional substrates (where the substrate thickness greatly exceeds the nanowire length), we identify three different regimes of heat propagation through the substrate: regime (i), where the nanowire temperature increases approximately logarithmically as a function of time. In this regime, the nanowire temperature is well-described analytically by You et al.[ APL89, 222513 (2006)]. We provide an analytical expression for the time tc that marks the upper applicability limit of the You model. After tc, the heat flow enters regime (ii), where the nanowire temperature stays constant while a hemispherical heat front carries the heat away from the wire and into the substrate. As the heat front reaches the boundary of the substrate, regime (iii) is entered where the nanowire and substrate temperature start to increase rapidly.For effectively two-dimensional substrates (where the nanowire length greatly exceeds the substrate thickness), there is only one regime in which the temperature increases logarithmically with time for large times, before the heat front reaches the substrate boundary. We provide an analytical expression, valid for all pulse durations, that allows one to accurately compute this temperature increase in the nanowire on thin substrates.