
181 Cal.App.2d 151 (1960)
MILES AND SONS, INC. (a Corporation), Petitioner,
v.
SUPERIOR COURT OF SAN JOAQUIN COUNTY, Respondent; ERNEST C. PAULLO et al., Real Parties in Interest.
Civ. No. 9935. 
California Court of Appeals. Third Dist.  
May 20, 1960.
 C. Ray Robinson and William J. Adams for Petitioner.
 No appearance for Respondent.
 William Wear Clark for Real Parties in Interest.
 VAN DYKE, P. J.
 This is a petition praying alternatively for a writ of prohibition to restrain the respondent court from proceeding further in a pending action in which petitioner is one of the defendants or for a writ of mandate to compel the respondent court to dismiss the action as against petitioner.
 The action against petitioner and others was commenced by the real parties in interest in the respondent court on December 24, 1956. Within three years thereafter petitioner was duly served with summons, but the return thereon was not made until January 4, 1960. However, on December 29, 1959, counsel for petitioner requested an extension of time in which to appear and plead, explaining that he might desire to make "certain preliminary motions." On December 30, 1959, counsel for petitioner prepared and forwarded the following, unsigned stipulation, together with a copy thereof, to the attorney for the real parties in interest:
 "Plaintiffs in the above entitled action, by and through their attorney, William Wear Clark, hereby stipulate and agree that the time which defendant, Miles & Sons, Inc., a Nevada Corporation, may appear, answer, demur or otherwise move or plead, is extended to and including January 15, 1960."
 "Dated: Dec. 31, 1959"
 ____________________
 Attorney for Plaintiffs.""
 The attorney for the real parties in interest signed the requested stipulation and filed it in the respondent court on January 4, 1960. On the same day petitioner noticed a motion for dismissal of the action, which motion was made and argued on January 11th and thereafter denied. Petitioner contends that it was mandatory upon the trial court to dismiss the action as the return of summons was not made until more than three years after the commencement of the action. (Beckwith *153 v. County of Los Angeles, 132 Cal.App.2d 377, 379 [282 P.2d 87].)
 Section 581a of the Code of Civil Procedure provides, in part: "No action heretofore or hereafter commenced shall be further prosecuted, and no further proceedings shall be had therein, and all actions heretofore or hereafter commenced must be dismissed by the court in which the same shall have been commenced, on its own motion, or on the motion of any party interested therein, ... unless the summons shall be served and return thereon made within three years after the commencement of said action, except where the parties have filed a stipulation in writing that the time may be extended. ..." (Emphasis added.)
 The language of the above italicized, exceptionary clause in section 581a is identical with that of section 583 of the same code. [1] The stipulation under section 583 need not be filed nor even executed prior to the expiration of the five-year period. (Estate of Thatcher, 120 Cal.App.2d 811, 814 [262 P.2d 337].) It is sufficient if the stipulation is filed prior to the motion to dismiss (Lewis v. Neblett, 48 Cal.2d 564, 568 [311 P.2d 489]), or prior to an order of dismissal. (Estate of Thatcher, supra.) The same rules must apply to a stipulation filed under section 581a as that section and section 583 are similar in purpose. (Wyoming Pac. Oil Co. v. Preston, 50 Cal.2d 736, 740 [329 P.2d 489].) Therefore, the question is whether the stipulation extending petitioner's time to plead constituted a stipulation extending the time for the return of summons. [2] Stipulations must be interpreted as are ordinary contracts. (Woley v. Turkus, 51 Cal.2d 402, 407 [334 P.2d 12].) [3] To serve as an extension under section 583 the stipulation must be written and expressly extend the time of trial or expressly waive the right to a dismissal. (J. C. Penney Co. v. Superior Court, 52 Cal.2d 666, 669 [343 P.2d 919]; Westphal v. Westphal, 61 Cal.App.2d 544, 547 [143 P.2d 405]--holding that a stipulation extending the time within which to answer was not a stipulation that the time of trial might be extended; Elmhurst Packers v. Superior Court, 46 Cal.App.2d 648 [116 P.2d 487]--holding that a stipulation extending time to answer until 10 days' written notice to do so did not extend the time for trial.)
 Let a peremptory writ of mandate issue directing the respondent court to dismiss the action against petitioner.
 Peek, J., and Schottky, J., concurred.
