
4 Cal.2d 120 (1935)
ROSEFIELD PACKING COMPANY (a Corporation), Petitioner,
v.
THE SUPERIOR COURT OF THE CITY AND COUNTY OF SAN FRANCISCO et al., Respondents.
S. F. No. 15355. 
Supreme Court of California. In Bank.  
July 30, 1935.
 McEnerney, Morris, Gillen & McEnerney for Petitioner.
 Brobeck, Phleger & Harrison for Respondents.
 LANGDON, J.
 This is a petition for a writ of prohibition to restrain respondent Superior Court from proceeding with the trial of a cause.
 Planters Nut and Chocolate Company brought an action against Rosefield Packing Company by filing a complaint on August 17, 1929. Defendant answered on or about September 27, 1929. Prior to the 1933 amendment of section 583 of the Code of Civil Procedure, an action not brought to trial within five years after filing of the answer was subject to mandatory dismissal. The amendment, effective August 21, 1933, made it compulsory to dismiss an action not brought to trial within five years after filing of the "action". On October 11, 1934, *122 the defendant moved to dismiss the action for lack of prosecution. This date was more than five years after filing of the complaint, and it is the contention of defendant, petitioner herein, that the action was subject to dismissal under the provisions of the statute as amended. The lower court denied the motion and set the case for trial. Petitioner then sought a writ of prohibition to restrain the court from proceeding further in the matter. Respondent has demurred to the petition for writ of prohibition, and the question presented is one of law alone.
 [1] The amendment to section 583 by its terms makes the statute retroactive, for it applies to "any action heretofore or hereafter commenced". No room for construction is permitted, and the law as amended undoubtedly applies to the present proceeding.
 [2] The question of constitutionality may be determined upon settled principles. The retrospective application of a statute may be unconstitutional if it is ex post facto, that is, applying to criminal matters; or if it deprives a person of a vested right; or if it impairs the obligation of a contract. But a statute which merely effects a change in civil procedure may have a valid retrospective application. (See Los Angeles v. Oliver, 102 Cal.App. 299 [283 P. 298]; San Bernardino v. Industrial Acc. Com., 217 Cal. 618 [20 PaCal.2d 673].) [3] In accordance with this principle it has been specifically held that the legislature may shorten or extend the period of the statute of limitations, or similar time statutes relating to procedure, and that the changed period may be made applicable to pending proceedings. (Davis & McMillan v. Industrial Acc. Com., 198 Cal. 631 [246 P. 1046, 46 A.L.R. 1095]; Steinbauer v. Bondesen, 125 Cal.App. 419 [14 PaCal.2d 106]; Kozisek v. Brigham, 169 Minn. 57 [210 N.W. 622, 49 A.L.R. 1260].) There is, of course, one important qualification to the rule: where the change in remedy, as, for example, the shortening of a time limit provision, is made retroactive, there must be a reasonable time permitted for the party affected to avail himself of his remedy before the statute takes effect. If the statute operates immediately to cut off the existing remedy, or within so short a time as to give the party no reasonable opportunity to exercise his remedy, then the retroactive application of it is unconstitutional as *123 to such party. (Coleman v. Superior Court, 135 Cal.App. 74 [26 PaCal.2d 673].)
 [4] In the instant case the statute went into effect on August 21, 1933. The five-year period from the filing of the complaint ended August 17, 1934. The plaintiff, therefore, had practically an entire year to bring his case to trial, after the enactment of the amendment. There can be no doubt but that this was a reasonable time, and that consequently the amended statute may be applied to the action without violating any constitutional right of the plaintiff. Much shorter periods have been upheld. (See Kozisek v. Brigham, supra; note, 49 A.L.R. 1263; Kerckhoff-Cuzner Mill & Lumber Co. v. Olmstead, 85 Cal. 80 [24 P. 648].)
 Respondents contend, however, that several recent decisions of the District Court of Appeal sustain the refusal to dismiss the cause. The first is Coleman v. Superior Court, supra, in which the court fully discussed and approved the general principles hereinabove stated, but concluded that to apply the statute retroactively would be to deny the party a reasonable time for the exercise of his right. Accordingly, a writ of prohibition was denied. But in that case, the action had been commenced in 1920, and though time for answer had been several times extended, the five-year period from the filing of the complaint had elapsed long before the amendment to the law became effective. The amendment immediately cut off the plaintiff's right to proceed in the cause, and was consequently held inapplicable. Such is not, of course, the situation presented in the instant case, where nearly a year elapsed from the effective date of the amendment to the time when the five-year period ended. The second case is Masonic Mines Assn. v. Superior Court, 136 Cal.App. 298 [28 PaCal.2d 691], which deals with a similar statute, and follows the Coleman case in stating the proposition that "an amendment will not be held applicable to a pending case where the amendment will, if operative, require the taking of some action prior to the effective date of the amendment". This case is, likewise, dissimilar to the instant case. The other decision is Shoemaker v. Superior Court, 4 Cal.App.2d 586 [41 PaCal.2d 343]. There the action was commenced October 21, 1929. The five-year period was concluded October 21, 1934. The amendment became effective in August, 1933, so that the plaintiffs had over a year in which to bring the *124 action to trial. In this respect, therefore, the case is substantially similar to the instant case. The motion to dismiss the cause was made in November, 1934, and the lower court refused to dismiss. Upon petitions for mandate and prohibition, the District Court of Appeal held that under the rule laid down in the Coleman case, the time for bringing the action to trial after the effective date of the amendment must be reasonable under all of the circumstances; that the lower court in the exercise of a sound discretion had power to determine whether the time was reasonable or not; and that neither mandate nor prohibition would therefore lie to determine the correctness of such discretionary ruling.
 [5] It is clear that the Shoemaker case proceeds upon an erroneous interpretation of the principle considered in the Coleman case. Whether there was a reasonable time in these cases is not a matter committed to the discretion of the trial court. The question is one of constitutionality of the statute which in terms applies to the pending case; and if it appears that there was a reasonable time for exercise of the remedy before the statutory bar became fixed, the lower court cannot consider individual hardship or other circumstances, but must give effect to the express provisions of the law. On this point the case of Shoemaker v. Superior Court, supra, must be disapproved.
 [6] Respondents advance the further argument that by stipulation of the parties, an amended complaint was filed March 16, 1933, which extended the time of mandatory dismissal to five years after its filing. The case of Mercantile Investment Co. v. Superior Court, 218 Cal. 770 [25 PaCal.2d 12], is cited in this connection. That case arose under the former statute, the period dating from the filing of the defendant's answer. The plaintiff filed an amended complaint, and it was stipulated that the answers already on file should be deemed answers to the amended complaint. We held that the period began to run on that date, which was considered to be the date of defendants' last answers. This interpretation of the old statute, making the period run from the last pleading of the defendant, was permissible under the language of the section, namely, "within five years after the defendant has filed his answer". But the present law reads: "within five years after the plaintiff has filed his action". *125 The action is commenced when the complaint is filed. (Code Civ. Proc., secs. 350, 405.) To sustain respondents' view, we should have to restate the section so as to substitute for the word "action" the words "last amended complaint". This would not be a construction of the statute, but a revision thereof, in direct conflict with its present meaning. Whatever may be the considerations of policy, in its legal effect the new statute cannot be held to mean what respondents urge in this connection. If it is desired to prolong the period in which the action must be brought to trial, it is necessary to stipulate to that effect, and we cannot hold that the filing of the amended complaint is a substitute for such a stipulation.
 Let a writ of prohibition issue as prayed.
 Preston, J., Shenk, J., Thompson, J., Seawell, J., and Waste, C.J., concurred.
