After a jury convicted appellant of retail theft, the trial court granted him a new trial. Another judge denied his petition for writ of habeas corpus, and he has filed this appeal of that denial. In the midst of a plethora of unmeritorious collateral attacks on his conviction, appellant’s pro se brief argues that it would be double jeopardy to subject him to a second trial on the facts of this case. Hudson v. Louisiana, 450 U.S. 40, 101 S.Ct. 970, 67 L.Ed.2d 30 (1981), which appellant does not cite, conclusively establishes that proposition if the issue is properly before us. But the tangled procedural circumstances require a detailed review of the facts and proceedings, as well as a summary of the law of double jeopardy.
I. DOUBLE JEOPARDY
There is a double jeopardy clause in the United States Constitution, amend. V,1 in the Utah Constitution, art. I, § 12,2 and in our Code of Criminal Procedure, U.C.A., 1953, § 77-l-6(2)(a).3 The double jeopardy provision of the Fifth Amendment is a guarantee so fundamental to American criminal justice that it has been held binding on the States through the Fourteenth Amendment. Benton v. Maryland, 395 U.S. 784, 794, 89 S.Ct. 2056, 2062, 23 L.Ed.2d 707 (1969). Consequently, in this area we deal with a combined federal and state guarantee. On the basis of the reported cases, we conclude that all of these guarantees have the same content.
The immunity guaranteed by the various double jeopardy provisions is simple in theory but technical in implementation. The United States Supreme Court recently explained the theory as follows:
The Double Jeopardy Clause forbids a second trial for the purpose of affording the prosecution another opportunity to supply evidence which it failed to muster in the first proceeding. This is central to the objective of the prohibition against successive trials. The Clause does not allow “the State ... to make repeated attempts to convict an individual for an alleged offense,” since “[t]he constitutional prohibition against ‘double jeopardy’ was designed to protect an individual from being subjected to the hazards of trial and possible conviction more than once for an alleged offense.”
Burks v. United States, 437 U.S. 1, 11, 98 S.Ct. 2141, 2147, 57 L.Ed.2d 1 (1978).
The implementation of this simple principle is complicated when it must be applied to a second trial following a conviction that was vacated on appeal or on motion for new trial. Thus, it was established early in Utah law that double jeopardy was no barrier to a second trial when the defendant had moved for a new trial on the basis of errors in the first. State v. Kessler, 15 Utah 142, 49 P. 293 (1897). The best statement of the rationale for that position is State v. Jaramillo, 25 Utah 2d 328, 329, 481 P.2d 394, 395 (1971), where the Court said:
Where the defendant has complained of errors that vitiate the prior proceedings and judgment and they are nullified at his request, he cannot then take the inconsistent position that there was a valid proceeding and judgment against him which constitute a former jeopardy. *324When he makes such a successful attack upon his conviction because of some prejudicial error, what he is entitled to is a trial or other appropriate proceeding in the absence of the error.
In contrast, where the evidence has been presented to the jury and the court aborts the trial without the consent of the defendant and without some special necessity, double jeopardy prevents a second trial. State v. Ambrose, Utah, 598 P.2d 354 (1979); State v. Thompson, 58 Utah 291, 199 P. 161, 38 A.L.R. 697 (1921); State v. Hows, 31 Utah 168, 87 P. 163 (1906). Of course, double jeopardy is no bar to retrial if the jury is unable to agree on a verdict. State v. Gardner, 62 Utah 62, 217 P. 976 (1923).
II. FACTS AND PROCEEDINGS
The record facts pertinent to this appeal are undisputed. Appellant was charged with retail theft, U.C.A., 1953, § 76-6-602(1), committed “on or about March 5, 1982.” The information states that he took two women’s suits, valued at $800, from Nordstrom at 50 South Main in Salt Lake City, that when he was confronted and stopped outside the store he dropped them and fled, and that he was apprehended shortly thereafter. Appellant was held without bail because, according to the information, he was then on parole from the Utah State Prison, where he had been serving a sentence for burglary.
Appellant’s trial was held on May 17, 1982. Two women’s suits were admitted into evidence and two witnesses, both employees of Nordstrom, testified for the prosecution. In formulating questions to these two witnesses, the deputy county attorney referred to March 22 rather than March 5 (the date charged in the information), and all of the witnesses’ testimony about the theft and appellant’s involvement related to March 22. It is undisputed that on March 22 appellant was in jail awaiting trial on this charge. Appellant claims in his brief in this Court that he had witnesses in court to testify to the events of March 5, but did not use them because all of the prosecution’s testimony related to March 22. All that the record shows on this subject is that the defendant called no witnesses and introduced no evidence.4
In closing argument, defense counsel referred to the discrepancy in dates and contended that the jury could not convict defendant of a charge of theft on March 5 on the basis of testimony of events on March 22. This argument gave the prosecution its first inkling of the mistake in its questions and in the witnesses’ testimony. The prosecutor admitted the mistake in rebuttal to the jury, but did not move to reopen the case and recall the witnesses. After being instructed in the same terms as the information (an offense committed on March 5), the jury found appellant guilty as charged.
On May 21, 1982, before sentencing, appellant’s counsel filed a written motion for a judgment of acquittal notwithstanding the verdict, and, in the alternative, for either an arrest of judgment or a new trial. The motion was based on insufficiency of the evidence and contained no mention of double jeopardy. On June 29, 1982, the trial court denied the first two motions but granted a new trial. The minute entry reads: “In lieu of motion for acquittal, defendant is granted a new trial.”
On July 12, 1982, appellant filed a pro se petition for a writ of habeas corpus, which sought release on the claim that he was held in violation of his state and federal constitutional rights. The principal basis cited for that claim was the fact that appellant had been convicted of a crime that the witnesses testified took place on March 22, when, appellant states, he was incarcerated in the Salt Lake County jail on that date. The petition made no mention of double jeopardy if he was retried. After a hearing on July 22 (before a different judge than had presided at the trial), the petition was denied. The order makes no mention of double jeopardy and merely finds that ap*325pellant had been granted the only relief that was necessary by the award of a new trial. Appellant took this timely appeal from that order.
We think the issue of double jeopardy is appropriately before us notwithstanding the lack of specific focus on double jeopardy in the pro se petition or in the order in the district court. Both parties argue the double jeopardy issue in their briefs on this appeal.5 The right to release from confinement on charges for which a petitioner could not be tried without a violation of double jeopardy can be raised by habeas corpus under Utah R.Civ.P. 65B(f) (illegal restraint of liberty). This is the traditional role of habeas corpus. Spain v. Stewart, Utah, 639 P.2d 166 (1981). It appears from the parties’ briefs and the trial record that appellant’s counsel repeatedly raised the double jeopardy issue in the district court following the denial of habeas corpus relief.6 It also appears that trial dates were repeatedly set and continued during the remaining months of 1982 and 1983. The latest record entry shows that the prosecution was still actively trying to bring appellant to trial on the charge of retail theft on March 5, 1983, and, as discussed in Part IV, finally obtained a guilty plea later that month.
For all these reasons, we conclude that the question of double jeopardy is properly before us on this appeal from the denial of habeas corpus.
III. RULING ON MERITS
We think it would clearly be double jeopardy to bring appellant to trial a second time on these charges.7 Hudson v. Louisiana, supra, is squarely in point on its facts. There a defendant was put through an entire trial, found guilty, and then granted a new trial on the basis of insufficient evidence to support the verdict. The Court held that the prohibition of double jeopardy bars retrial in that circumstance.
It is hard to imagine a clearer violation of the policy served by the constitutional and statutory prohibitions against double jeopardy than the facts of this case. As the Supreme Court said in the passage quoted earlier from Burks v. United States (same facts as Hudson except new trial granted on appeal instead of by trial court), a new trial in this circumstance would amount to “affording the prosecution another opportu*326nity to supply evidence which it failed to muster in the first proceeding.”
The State cites § 77-35-24(a) to demonstrate that the trial court may grant a new trial on the motion of either party or on its own initiative for “any error or impropriety which had a substantial adverse effect upon the rights of a party.” But the power conferred by that section does not override the constitutional right not to be put in jeopardy twice for the same offense. The double jeopardy clause stands as a major qualification of the power to grant a new trial in a criminal case (except, of course, where the motion is made by the defense).
Here, the new trial did come in response to appellant’s own motion (in the alternative), and the State relies on that fact to contend that appellant has no double jeopardy defense against a retrial in this case. We reaffirm the general rule that a defendant who obtains a new trial on the basis of errors in the trial or guilty plea that lead to his conviction can be retried without double jeopardy. State v. Jaramillo, supra; Cobb v. Snow, 14 Utah 2d 170, 380 P.2d 457 (1963); State v. Lawrence, 120 Utah 323, 331-32, 234 P.2d 600, 604 (1951); State v. Kessler, supra. But that principle does not apply to the “error” of convicting a defendant on insufficient evidence. If the defendant could not challenge that error without forfeiting his right to assert the bar of double jeopardy on a retrial, the protection of that clause would be rendered nugatory. As the Supreme Court held in Burks v. United States, “it makes no difference that a defendant has sought a new trial as one of his remedies, or even as the sole remedy. It cannot be meaningfully said that a person ‘waives’ his right to a judgment of acquittal by moving for a new trial.” 437 U.S. at 17, 98 S.Ct. at 2150.
The State further argues that the variance between the March 5 date in the information and the March 22 date in the witnesses’ testimony was (1) minor and (2) unimportant because time was not an element of the crime. We disagree with both points. First, the. seventeen-day disparity between charge and evidence in this case was not minor and surely exceeds the one-to three-day tolerance we have recognized in the approximation of “on or about.”8
Second, on the facts of this case, the disparity in dates was important. The statement in the cases relied on by the State that “time is not an essential element of the crime,” State v. Wilson, Utah, 642 P.2d 394, 395 (1982); United States v. Davis, 436 F.2d 679, 682 (10th Cir.1971), means no more than that the charged offense would be criminal on either date in question. That is, on the facts of those cases there was no defense such as a period of limitations or a change in the age of defendant or victim that would keep the act from being criminal or punishable on one date but not on the other. In contrast, time is always an essential element of a crime in the sense that due process requires that an accused be given sufficiently precise notification of the date of the alleged crime that he can prepare his defense. Neither the Wilson nor the Davis case involved any deficiency in notice. There, the prosecutors recognized typographical errors in the charging documents prior to the trials and gave defendants prompt notice of the true dates of the alleged offenses. When each case went to trial, both prosecution and defense knew the date of the alleged offense, and there was no suggestion on either appeal that the evidence had deviated from that date.
This case is distinguishable. Here, the error was in the evidence (a material difference between the trial testimony and the date charged in the information), the error occurred during the trial, and the error took the defendant entirely by surprise. Because the error was in the evidence, this case presents the spectacle of a prosecutor’s allowing a jury to commence its deliberations on the basis of sworn testimony the prosecutor knows to be false. Cf. Alcorta v. *327Texas, 355 U.S. 28, 78 S.Ct. 103, 2 L.Ed.2d 9 (1957); Pyle v. Kansas, 317 U.S. 213, 63 S.Ct. 177, 87 L.Ed. 214 (1942). True, the prosecutor admitted in rebuttal that the testimony about the date of the offense was in error and should have been March 5, but what was the jury supposed to do with that admission? The prosecutor’s attempt to change the witnesses’ testimony from March 22 to March 5 was not under oath. On the record, the jury had no evidence tying the defendant to a theft committed “on or about March 5,” as charged in the information and the judge’s instructions.
And what about the defense? It had no need to introduce evidence as to a March 5 theft, since no such theft was proved at trial. On the other hand, if the prosecutor’s rebuttal could be taken as changing the witnesses’ sworn testimony from March 22 to March 5, the defense was denied an opportunity to respond to the amended evidence.
For all these reasons, we have no doubt that a judgment of conviction on this evidence would have been reversed for insufficient evidence if it had been appealed. In that event, we would have ordered that the charges be dismissed and that the defendant be discharged from custody under them. State v. Petree, Utah, 659 P.2d 443, 447 (1983); State v. Lakey, Utah, 659 P.2d 1061, 1064 (1983). Cf. § 77-35-23 (no order of commitment after arrest of judgment where “jeopardy has attached”).
After the jury found him guilty but before he was sentenced, appellant filed a motion seeking a judgment of acquittal or, in the alternative, arrest of judgment or a new trial. The district court’s granting of a new trial and appellant’s failure to appeal the denial of his motion for a judgment of acquittal set the stage for the procedural complications that have bedeviled this case. The correct result could still have been achieved by granting this petition for a writ of habeas corpus or by granting one of appellant’s subsequent motions to dismiss. The motions to dismiss are not before us on this appeal, but the habeas corpus petition is. We can assure that appellant will not be placed in double jeopardy by reversing the order denying the writ of habeas corpus and by remanding the case with instructions to discharge appellant from custody under these or substitute charges. That will.be the order of this Court.
IV. MOOTNESS BY GUILTY PLEA
After this appeal was submitted, the State filed a motion to dismiss the appeal. The State showed that on March 30, 1983, in lieu of retrial on the pending charge of retail theft, appellant pleaded guilty to a charge of theft by receiving (the same merchandise), and the prosecution recommended that his sentence give credit for the time he had already served in jail. Sentence has not yet been imposed. Citing Tollett v. Henderson, 411 U.S. 258, 93 S.Ct. 1602, 36 L.Ed.2d 235 (1973) (composition of grand jury), the State now argues that appellant’s guilty plea had the effect of waiving all non jurisdictional errors in the prior proceedings and requires dismissal of this appeal.
The short answer to the State is that this identical argument was made and expressly rejected in Menna v. New York, 423 U.S. 61, 96 S.Ct. 241, 46 L.Ed.2d 195 (1975). That case reversed a state decision that a double jeopardy claim was waived by a guilty plea. The Court held:
Where the State is precluded by the United States Constitution from haling a defendant into court on a charge, federal law requires that a conviction on that charge be set aside even if the conviction was entered pursuant to a counseled plea of guilty.
Id. at 62, 96 S.Ct. at 242. For the reasons stated in Menna v. New York, we consider its holding just as binding for this plea to the substituted charge of theft by receiving as it would have been to a plea to the original charge of retail theft. The motion to dismiss for mootness is therefore denied.
The order denying the writ of habeas corpus is reversed, and the case is remanded *328for the entry of an order consistent with this opinion.
HALL, C.J., and STEWART and DURHAM, JJ., concur.. “[N]or shall any person be subject for the same offence to be twice put in jeopardy of life or limb .... ”
. “[N]or shall any person be twice put in jeopardy for the same offense.”
. “No person shall be put twice in jeopardy for the same offense
. We have obtained the record in appellant’s trial, Third District Court No. CR 82-416, by a writ of certiorari in aid of our appellate jurisdiction in the pending appeal from the denial of habeas corpus. Boggess v. Morris, Utah, 635 P.2d 39, 42-43 (1981).
. The issue of double jeopardy could not have been raised by appeal from the original conviction. Appellant could not have appealed his conviction by the jury because, sentence not having been passed, there was no final judgment to appeal. U.C.A., 1953, § 77-35-26(b)(1); State v. Gerrard, Utah, 584 P.2d 885, 886 (1978); State v. Wood, 14 Utah 2d 192, 381 P.2d 78 (1963). Similarly, appellant could hardly have appealed from the granting of a new trial, since this was one of the alternatives he had sought from the trial court. Compare § 77-35-26(b)(2); State v. Morgan, 23 Utah 212, 229-30, 64 P. 356, 361 (1901) (order denying motion for new trial appealable).
. On July 30, 1982, appellant’s trial counsel filed a motion to dismiss the information on the ground that a second trial would be double jeopardy. The motion, which relied on Burks v. United States, supra, and Hudson v. Louisiana, supra, was denied by minute entry on the same date. After substitute counsel was appointed in August 1982, he renewed that motion on the same grounds on at least three separate occasions. Each time, it was denied by minute entry. Each of these denials was a final order for purposes of appeal. We so held in State v. Ambrose, Utah, 598 P.2d 354, 357 (1979), for the obvious reason that an application of the normal rule of finality, under which the losing party must wait until after the trial to challenge intermediate rulings, would force the defendant to suffer the prejudice the double jeopardy clause seeks to prevent before he would have an appellate forum to hear his claim. Despite that fact, counsel took no appeal from these denials, although he attempted to pursue an “interlocutory appeal” on one occasion.
.The question of whether “jeopardy” attached in the first proceeding is not at issue in this case, since the earlier proceeding was an entire trial. The Utah rule that jeopardy attaches when the jury is impaneled and sworn, State v. Ambrose, 598 P.2d at 358; Boyer v. Larson, 20 Utah 2d 121, 122, 433 P.2d 1015, 1016 (1967); State v. Whitman, 93 Utah 557, 559, 74 P.2d 696, 697 (1937), is the same as the rule now binding on the states as a matter of federal constitutional law. Crist v. Bretz, 437 U.S. 28, 98 S.Ct. 2156, 57 L.Ed.2d 24 (1978).
. E.g., In re R.G.B., Utah, 597 P.2d 1333, 1335 (1979); State v. Wadman, Utah, 580 P.2d 235 (1978); State v. Middelstadt, Utah, 579 P.2d 908, 910 (1978).