
110 S.W.3d 832 (2003)
Terry WEBSTER, Petitioner/Appellant,
v.
James PURKETT, Superintendent, Farmington Correctional Center and Phyllis Byland, Records Officer, Respondents.
No. ED 81387.
Missouri Court of Appeals, Eastern District, Division Four.
May 20, 2003.
Motion for Rehearing and/or Transfer Denied July 24, 2003.
*833 Richard H. Sindel, Clayton, MO, for appellant.
Jeremiah W. (Jay) Nixon, Atty. Gen., & Tamara D. Ader, Jefferson City, MO, for respondents.
Motion for Rehearing and/or Transfer to Supreme Court Denied July 24, 2003.
WILLIAM H. CRANDALL, JR., Presiding Judge.
Petitioner, Terry Webster, filed a petition for declaratory judgment or in the alternative writ of habeas corpus after the Department of Corrections recalculated his entitlement to jail-time-credit under section 558.031 RSMo.1986. Petitioner appeals from the trial court's grant of summary judgment entered in favor of respondents, James Purkett and Phyllis Byland. We affirm in part and dismiss in part.
On February 23, 1988, petitioner was charged with multiple felonies for crimes committed the previous day (hereafter County cases). Petitioner's bond for the County cases was revoked and he surrendered on March 23, 1989. On April 10, 1989, petitioner was delivered to Missouri's Department of Corrections (hereafter DOC) to serve a fifteen-year sentence for a conviction, not related to the County cases, for possession of a controlled substance, heroin (hereafter City case). On February 25, 1991, petitioner pleaded guilty to assault in the first degree, felonious restraint, two counts of armed criminal action and possession of a controlled substance, cocaine for the charges arising from the County cases. Petitioner was sentenced to concurrent terms of fifteen years for the felonious restraint conviction, *834 seven years for the possession conviction and twenty-five years each for the assault conviction and the two armed criminal action convictions.[1] The court also ordered that petitioner "receive credit for jail time awaiting trial and sentencing pursuant to [section] 558.031 RSMo." Initially, DOC listed April 10, 1989, as the sentence start date for the County cases. For the three County cases that petitioner received a twenty-five year sentence, his conditional and maximum release dates were listed as April 9, 2009 and April 9, 2014. In August 2001, DOC determined that a calculation error occurred and that the sentence start date for the County cases was the date he was sentenced for those convictions, February 25, 1991. His conditional and maximum release dates for the three County cases for which he was sentenced to twenty-five years were recalculated to be February 24, 2011 and February 24, 2016.
Petitioner brought an action against respondents, James Purkett and Phyllis Byland, the superintendent and records officer, respectively, at Farmington Correctional Center. Petitioner's pro se action was styled "PETITION FOR DECLARATORY JUDGMENT AND ATTENDANT INJUNCTIVE RELIEF OR PETITION BE CONSTRUED AS A WRIT OF HABEAS CORPUS PURSUANT TO RULE 91.02 & 91.09." Petitioner claimed that for the sentences entered on the County cases he was entitled to jail-time credit of 685 days; from April 10, 1989, when he was delivered to the DOC, until February 25, 1991, when he entered his pleas and was sentenced for the County cases. Petitioner alleged that he "reasonably believed and was told" that all parties, his attorney, the prosecutor and the trial court, were in agreement that he would receive the credit. Petitioner stated that "[a]ll parties involved in the plea agreement and as well as the [c]ourt intended" that he would receive the credit. Petitioner further alleged that respondents' denial of the credit rendered his pleas for the County cases involuntary, unknowing and unintelligently made. Respondents filed a motion for summary judgment. Respondents argued that under section 558.031 RSMo.1986, petitioner was not entitled to jail-time credit because from April 10, 1989 to February 25, 1991, he was in prison for a different crime before he was sentenced for the County cases. As for petitioner's claim that his plea was involuntary, respondents argued that petitioner could not "bring this claim before a habeas court."[2] On February 28, 2002, the trial court entered judgment granting respondents' summary judgment motion. The court declared that petitioner was not entitled to jail-time credit under section 558.031.1 RSMo.1986 because he "was serving another sentence at the time in question rather than being detained upon another charge." The trial court made no specific findings on petitioner's claims regarding the plea agreement and voluntariness of his pleas.
*835 On March 13, 2002, petitioner filed a motion for new trial or in the alternative for "rehearing" on his petition for habeas corpus and application for change of judge, which the trial court denied that day. On April 12, 2002, petitioner filed a petition in this court that was styled exactly as the petition in the trial court. In this petition, petitioner raised the same claims he raised in the trial court. This court considered petitioner's filing as a petition for habeas corpus. On April 12, 2002, petitioner also filed a notice of appeal from the trial court's judgment. On April 25, 2002, this court denied the petition for writ of habeas corpus without opinion. Thereafter, this court granted petitioner's motion to file a late notice of appeal from the trial court's judgment. Petitioner raises two points on appeal.
Our review of the trial court's grant of summary judgment is essentially de novo. Mudloff v. Missouri Dep't of Corr., 53 S.W.3d 145, 146 (Mo.App. W.D.2001). Summary judgment will be upheld on appeal if there is no genuine issue of material fact and the movant is entitled to judgment as a matter of law. Id.
We first address whether petitioner was entitled to the jail-time credit under section 558.031. A prisoner may file either a petition for declaratory judgment or a petition for an extraordinary writ of habeas corpus or mandamus for a determination of entitlement to a credit for jail time under section 558.031. State ex rel. Nixon v. Kelly, 58 S.W.3d 513, 516 (Mo. banc 2001); Goings v. Missouri Dep't of Corr., 6 S.W.3d 906, 907 (Mo. banc 1999); Murphy v. State, 873 S.W.2d 231, 232 (Mo. banc 1994); State v. Oakes, 84 S.W.3d 562, 563 (Mo.App. S.D.2002). Here, petitioner filed a petition for declaratory judgment or in the alternative writ of habeas corpus. The issue shall be considered as an appeal from declaratory judgment.
In both points on appeal, petitioner raises arguments on this issue. Petitioner contends that the trial court erred in granting respondents' summary judgment motion because, based on the facts alleged in the pleadings, the court should have granted him credit for time served or reduced his sentence for the County cases by at least 685 days. Petitioner also contends that the trial court erred in granting respondents' summary judgment motion without conducting an evidentiary hearing because there were genuine issues of material fact as to whether respondents wrongfully denied him the jail-time credit and whether during the 685 day period St. Louis County filed a detainer with DOC, thereby requiring that he receive the credit under section 558.031.1(1).
The statute at issue is section 558.031 RSMo.1986 that provided as follows[3]:
1. A person convicted of a crime in this state shall receive as credit toward service of a sentence of imprisonment all time spent by him in prison or jail both because awaiting trial for such crime and pending transfer after conviction to the department of corrections or the place of confinement to which he was sentenced. Time required by law to be credited upon some other sentence shall be applied to that sentence alone, except that
(1) Time spent in jail or prison awaiting trial for an offense because of a detainer for such offense shall be credited toward service of a sentence of imprisonment for that offense even *836 though the person was confined awaiting trial for some unrelated bailable offense; and
(2) Credit for jail or prison time shall be applied to each sentence if they are concurrent.
For the period, April 10, 1989 to February 25, 1991, petitioner was not confined in the DOC because he was awaiting trial for the County cases. On April 10, 1989, petitioner began serving a sentence in the DOC for the City case that was unrelated to the County cases.[4] Petitioner relies on the exception provided in subsection (1) of 558.031.1. The exception provides for credit on a sentence for "[t]ime spent in jail or prison awaiting trial for an offense because of a detainer for such offense... even though the person was confined awaiting trial for some unrelated bailable offense." But even if St. Louis County filed a detainer for the County cases, this does not render subsection (1) applicable. The time from April 10, 1989 to February 25, 1991 that petitioner spent in the DOC was not because of a detainer, if filed by St. Louis County. Rather, petitioner was confined in the DOC from April 10, 1989 to February 25, 1991, for the sentence entered for the City case that was unrelated to the County cases. "[A] defendant is not entitled to credit for time spent awaiting trial if he is already serving a sentence for an unrelated offense." Mudloff, 53 S.W.3d at 150. Under the exception provided in subsection (1), the time petitioner spent in the DOC from April 10, 1989 to February 25, 1991, does not qualify for credit on his sentences for the County cases. Roy v. Missouri Dep't of Corr., 23 S.W.3d 738, 745-46 (Mo.App. W.D.2000). The trial court did not err in declaring that petitioner was not entitled to the jail-time credit.
We next address petitioner's claims regarding the plea agreement and the voluntariness of his plea. In both points, petitioner raises arguments on this issue. Petitioner contends that his pleas for the County cases were involuntary because there was an agreement he would receive credit for the 685 days he served awaiting disposition of the County cases. Petitioner also contends that there were genuine issues of material fact as to whether his plea was involuntary because it was secured by a promise that he would receive the credit and whether such an agreement existed between the parties.
A threshold consideration is the proper action for petitioner to bring his claims regarding the plea agreement and the voluntariness of his pleas for the County cases. A claim that a person is entitled to credit for time served under section 558.031 cannot be brought in a Rule 24.035 motion. Murphy, 873 S.W.2d at 232. But petitioner's claims regarding a plea agreement and voluntariness of his pleas although related to are different from a claim of whether petitioner is entitled to the jail-time credit under section 558.031. Claims regarding the plea agreement and voluntariness of his plea are cognizable in a Rule 24.035 motion. Geitz v. State, 87 S.W.3d 350, 352 (Mo.App. E.D.2002). "Rule 24.035 provides the exclusive procedure by which such person may seek relief in the sentencing court for the claims enumerated." Rule 24.035(a). See Cooper v. State, 818 S.W.2d 653, 654 (Mo.App.1991); Plant v. Haynes, 568 S.W.2d 585, 587 (Mo. App.1978). Petitioner could not raise his claims regarding the plea agreement and *837 voluntariness of his pleas in a declaratory judgment action.
In cases where a person asserts a claim that comes within those enumerated under Rule 24.035, but the person asserts that he or she could not bring the claim within the time limits set out in Rule 24.035, then habeas corpus provides the mechanism for the person to attempt to obtain relief. Brown v. State, 66 S.W.3d 721, 730 (Mo. banc 2002).[5] A petitioner may be entitled to relief on a claim not raised in a post-conviction motion "if the petitioner can assert either: (1) a claim of actual innocence or (2) a jurisdictional defect or (3)(a) that the procedural default was caused by something external to the defensethat is, a cause for which the defense is not responsibleand (b) prejudice resulted from the underlying error that worked to his actual and substantial disadvantage." Id. at 731. The parties disagree if petitioner meets the cause and prejudice test set forth in Brown. However, we do not reach this issue. After setting forth the above quoted test, the court in Brown recognized that the denial of a petition for writ of habeas corpus is not appealable. Id. at 732. The court held that "if the petitioner believes a writ should have issued, the remedy is to file a new petition in a higher court." Id. Here, petitioner filed a petition for writ of habeas corpus which this court denied. As for petitioner's claims regarding the plea agreement and voluntariness of his pleas, his remedy, if any, is to file a petition for writ of habeas corpus in a higher court. Petitioner's appeal from the portion of the trial court's judgment denying his petition for writ of habeas corpus is dismissed.
Affirmed in part and dismissed in part.
SHERRI B. SULLIVAN and GLENN A. NORTON, JJ., concur.
NOTES
[1]  A "face sheet" from DOC reflects that on October 24, 1989, petitioner was sentenced to fifteen years each for three possession convictions, two attempted burglary convictions and one burglary in the first degree conviction. The "face sheet" also states that on February 25, 1991, petitioner was sentenced to seven years each for two possession convictions and ten years each for two convictions for unlawful use of a weapon.
[2]  On appeal, respondents state that they "admit that the reason originally argued [at the trial court], that the claim was not cognizable because claims were only cognizable if they concerned the court's lack of jurisdiction or a repealed/inapplicable statute, was modified by Brown v. State, 66 S.W.3d 721 (Mo. banc 2002)."
[3]  In 1995, the legislature amended section 558.031. Webster committed his crimes prior to the amendment and therefore the pre-amended version of section 558.031 quoted above applies here. Kelly, 58 S.W.3d at 518.
[4]  Webster began serving sentences for six additional felony convictions on October 24, 1989, see footnote 1.
[5]  In Brown, the court considered the motion court's denial of Brown's motion to withdraw his plea pursuant to Rule 29.07(d). Id. at 722. The court held that habeas corpus rather than Rule 29.07(d) provides the proper avenue for relief in those limited circumstances where the petitioner asserts a claim that is the type enumerated in Rule 24.035, but that is time-barred under that rule, if the petitioner can meet the cause and prejudice standard set forth in State ex rel. Nixon v. Jaynes, 63 S.W.3d 210 (Mo. banc 2001). Id. at 723.
