In this paper we construct a local formulation of the first law and the second law of thermodynamics for a nonequilibrium system such that their global forms are equivalent to Kelvin's principle and Clausius's principle. We also study the relationship between the entropy balance equation and the calotropy balance equation obtained by Eu [Phys. Rev. E 51, 768 (1995)] by examining the model equations of the nonconserved variables proposed by Jou, Casse-Vazquez, and Lebon [Rep. Prog. Phys. 51, 1105 (1988); Extended Irreversibie Thermodynamics (Springer, Heidelberg, 1993)] in extended irreversible thermodynamics.