Bardina and Jolis [Stochastic process. Appl. 69 (1997) 83–109] prove an extension of Itô’s formula for F(Xt, t), where F(x, t) has a locally square-integrable derivative in x that satisfies a mild continuity condition in t and X is a one-dimensional diffusion process such that the law of Xt has a density satisfying certain properties. This formula was expressed using quadratic covariation. Following the ideas of Eisenbaum [Potential Anal. 13 (2000) 303–328] concerning Brownian motion, we show that one can re-express this formula using integration over space and time with respect to local times in place of quadratic covariation. We also show that when the function F has a locally integrable derivative in t, we can avoid the mild continuity condition in t for the derivative of F in x.