
488 So.2d 33 (1986)
Grady BOUTWELL
v.
STATE.
3 Div. 370.
Court of Criminal Appeals of Alabama.
April 8, 1986.
*34 Grady Boutwell, pro se.
Charles A. Graddick, Atty. Gen., and J. Elizabeth Kellum, Asst. Atty. Gen., for appellee.
PATTERSON, Judge.
Appellant, Grady Boutwell, was convicted on April 12, 1965, of murder in the second degree and was sentenced to thirty years in the state penitentiary. His conviction was affirmed without opinion by this court and affirmed with opinion by the Alabama Supreme Court. Boutwell v. State, 279 Ala. 176, 183 So.2d 774 (1966).
On November 1, 1985, appellant filed a pro se pleading styled "Motion for Jail Time," in the Circuit Court of Escambia County, Alabama. Appellant alleged that he spent thirteen months in jail awaiting trial and that this time was not credited to his sentence as required by § 15-18-7, Code of Alabama 1975. The trial court summarily denied appellant's "motion." Appellant then filed a "Motion for a Written Statement as to Findings of Facts," seeking the court's reasons for denying his motion for jail time credit; this motion was also denied.
"A petition for writ of habeas corpus is a proper procedure to test whether the State has properly calculated the amount of time the inmate must serve in prison." Mead v. State, 475 So.2d 645 (Ala.Cr.App.1985). Appellant's motion was properly sworn to and we will view it as a petition for writ of habeas corpus, although not properly designated as such.
The State offered no facts which contradict those set out in the petition. Therefore, the unrefuted facts set out in the petition must be taken as true. Giles v. State, 462 So.2d 1063, 1064 (Ala.Cr.App. 1985), and cases cited therein. Section 15-18-5, Code of Alabama 1975, states:
"Upon conviction and imprisonment for any felony or misdemeanor, the sentencing court shall order that the convicted person be credited with all of his actual time spent incarcerated pending trial for such offense. The actual time spent incarcerated pending trial shall be certified by the circuit clerk or district clerk on forms to be prescribed by the board of corrections."
Section 15-18-7 states that § 15-18-5 "shall be applicable to any prisoner presently incarcerated who comes within the purview of sections 15-18-5 and 15-18-6." (No issue pertaining to § 15-18-6 has been raised.)
Appellant's unchallenged petition is meritorious on its face in view of §§ 15-18-5 and 15-18-7; therefore, he is entitled to habeas corpus relief if the asserted matters are true. The trial court should not have dismissed the petition without a hearing on the merits to ascertain facts sufficient to apply the applicable law.
We conclude that the trial court erred in summarily denying appellant's petition. Therefore, the trial court's judgment is hereby reserved, and this cause is remanded to the trial court for further proceedings consistent with this opinion.
REVERSED AND REMANDED.
All Judges concur.
