Based on the creep test results of salt rock, three stages of changes in the viscosity coefficient with time during the creep process of salt rock were delimited from the perspective of creep rate, namely, gradually increased stage, basically unchanged stage and gradually decreased stage. According to this variation, a nonlinear dashpot was proposed, and its viscosity coefficient was assumed as a function of creep time. Then, the dashpot in the Maxwell model was replaced by this nonlinear dashpot to establish an improved Maxwell model that can describe the whole creep process of rock. The rationality of the improved Maxwell model was verified based on the uniaxial compression creep test results of salt rock and the triaxial compression creep test results of coal. Comparisons of the theoretical curves of the model and test results show good agreement between them, and the model can describe the three stages of the whole creep process of rock with a unified expression, thereby overcoming the shortcomings of the traditional mechanical model that requires segmentation processing. Based on the secondary development platform of the FLAC[Formula: see text] software, the secondary development of the improved Maxwell model was achieved by using VC++ 6.0 development environment, and the computer application program of the model was obtained. Then, the secondary development program of the model was used to simulate the uniaxial compression creep test of salt rock and the triaxial compression creep test of coal. In general, the numerical simulation results are in good agreement with the test results, proving the correctness of the secondary development calculation program of the model.