
338 S.W.3d 400 (2011)
Darrell MILLER, Appellant,
v.
MISSOURI DEPARTMENT OF CORRECTIONS, Respondent.
No. WD 72699.
Missouri Court of Appeals, Western District.
April 5, 2011.
*401 Kent E. Gipson and Reed L. Wycuff, Kansas City, MO, for Appellant.
Chris Koster, Attorney General, Stephen D. Hawke, Assistant Attorney General, Jefferson City, MO, for Respondent.
*402 Before Division I: MARK D. PFEIFFER, Presiding Judge, and THOMAS H. NEWTON and ALOK AHUJA, Judges.
MARK D. PFEIFFER, Presiding Judge.
Darrell Miller ("Miller") appeals the dismissal of his petition for declaratory judgment by the DeKalb County Circuit Court ("trial court"). Miller requested additional credit for time served in custody prior to the commencement of his sentence on a fifteen-year prison term for a drug charge, arguing that the Missouri Department of Corrections (the "DOC") improperly calculated and credited time served in custody. We affirm.

Factual and Procedural Background
The facts are not disputed. They are:
On July 15, 1999, in Jackson County, Miller pleaded guilty to possession of a controlled substance and was sentenced to ten years in prison ("Case A"). On August 3, 2001, also in Jackson County, Miller pleaded guilty to trafficking in drugs in the first degree and received another ten-year sentence, which the court ordered to run concurrently with the first ten-year sentence ("Case B"). On April 7, 2003, Miller was released on parole for Case A and Case B. On May 5, 2004, in Ray County, Miller pleaded guilty to attempted manufacturing and producing a controlled substance, for which he received a sentence of fifteen years, and possession of drug paraphernalia with intent to use, for which he received a sentence of four years ("Case C"). Both sentences were ordered to run concurrently. Execution of both sentences was suspended, and Miller was ordered to complete a section 217.362[1] drug treatment program in the custody of the DOC beginning on May 6, 2004. Miller successfully completed the drug treatment program and was conditionally released on probation on December 8, 2005.
On February 14, 2007, Miller was once again arrested in Ray County on a charge of second-degree assault ("Case D").[2] Miller's arrest for assault violated both his probation conditions in Case C and parole conditions in Case A and Case B. On February 16, 2007, pursuant to a parole violation warrant, Miller was placed under arrest for violation of his parole conditions. On March 2, 2007, Miller's probation in Case C was suspended, and a warrant issued for his arrest for violation of his probation conditions. The probation violation warrant was served on March 6, 2007. Miller's Case C probation was revoked on December 7, 2007, and Case C sentencing was ordered executed.
On July 28, 2009, Miller filed a petition for declaratory judgment, requesting a declaration that the DOC credit Miller's fifteen-year sentence[3] for additional time Miller spent in custody related to the fifteen-year sentence before commencement of the sentence.[4] The DOC subsequently *403 filed a motion to dismiss, claiming that the petition failed to state a claim upon which relief could be granted. The trial court held a hearing and granted the motion to dismiss on June 1, 2010. Miller timely appealed.

Standard of Review
"In reviewing the dismissal of a declaratory judgment action for failure to state a claim, this court deems all well-pleaded facts to be true and determines whether they invoke principles of substantive law that would entitle the petitioner to relief." Monroe v. Mo. Dep't of Corr., 105 S.W.3d 915, 918 (Mo.App. W.D.2003). Stated differently, if the petition contains facts supporting its allegations, and not mere conclusions, and those facts demonstrate a justiciable controversy, then we will reverse the trial court's dismissal and remand the cause for a determination of the parties' rights. Id. When supplemental information is attached to the petition, the petition must be interpreted in light of the attachments. Id. at 922. We will affirm the trial court's judgment under any reasonable theory supported by the evidence, even if the reasons advanced by the trial court are wrong or insufficient. Trimble v. Pracna, 167 S.W.3d 706, 716 (Mo. banc 2005). Our primary concern is with the correctness of the trial court's result, not the route taken to reach that result. Id.

Analysis
Section 558.031.1 mandates credit "for all time in prison, jail or custody after the offense occurred and before the commencement of the sentence, when the time in custody was related to that offense." § 558.031.1 (emphasis added). "In construing [§ 558.031.1], we are guided by the principle that criminal statutes must be `construed strictly against the state and liberally in favor of the defendant.'" Goings v. Mo. Dep't of Corr., 6 S.W.3d 906, 908 (Mo. banc 1999) (citations omitted).
In its judgment below, the trial court explained its dismissal ruling as follows, in pertinent part:
[Miller] contends that he is entitled to this credit under § 558.031.1, RSMo. 2000. But that statute applies to periods in custody after the offense occurs but before sentence. [Miller] alleges he was sentenced on May 5, 2004 (Petition, page 3, paragraph 9). Accordingly, § 558.031.1, RSMo.2000 does not authorize [DOC] to give credit for the requested time, a period after sentencing.

(Emphasis added.)
Initially, we note that the trial court's reasoning erroneously assumes that the triggering event for section 558.031.1 "in custody" sentencing credit is before sentence, not before the commencement of the sentence. The statute does not fix the triggering event as the date of sentencing. Instead, the triggering event is "commencement of the sentence." There is, of course, a difference between the two. That difference is important to the analysis of this appeal.
In the present case, it is undisputed that Miller was "sentenced" to a fifteen-year prison term for the relevant drug charge on May 5, 2004. It is also undisputed that on that same date, the sentencing court suspended execution of the sentence[5] (i.e., the sentence did not "commence" on May *404 5, 2004) and placed Miller on probation and, as one requirement of probation, required Miller to complete a section 217.362 drug treatment program in the custody of the DOC beginning on May 6, 2004. Ultimately, Miller violated the terms of his probation, his probation was revoked, and on December 7, 2007, Miller's fifteen-year prison term was ordered to be executed. Accordingly, Miller's fifteen-year prison term "commenced" on December 7, 2007, and pursuant to section 558.031.1, Miller is entitled to receive credit toward the service of his fifteen-year prison term for all time "in prison, jail or custody" after he committed the Case C offense in 2004 and before his fifteen-year prison term "commenced" in 2007 "when the time in custody was related to that offense."
"Time in custody is generally `related to' a sentence, and thus eligible for credit within the subsection, if the inmate could have been free from custody absent the charge." Pettis v. Mo. Dep't of Corr., 275 S.W.3d 313, 317 (Mo.App. W.D.2008) (citing Mikel v. McGuire, 264 S.W.3d 689, 691-92 (Mo.App. W.D.2008)). Goings is one of the first cases to interpret section 558.031.1 after its revision in 1995. In that case,
Mr. Goings was on parole for Charge 1 when he was arrested for Charge 2. Because of his arrest for Charge 2, his parole on Charge 1 was revoked and he was placed in prison. He remained in prison while awaiting his trial on Charge 2, of which he was eventually convicted. This Court held that the time that Mr. Goings spent in custody prior to receiving his sentence on Charge 2 was "related to" that sentence because it was Goings' arrest on Charge 2 that resulted in revocation of parole on Charge 1 and returned him to custody.

State ex rel. Nixon v. Kelly, 58 S.W.3d 513, 519 (Mo. banc 2001) (emphasis added). Goings highlighted the legislature's choice of the broad language "related to" instead of the stricter phrases "caused by" or "the result of." 6 S.W.3d at 908. However, "related to" is only established where the subsequent offense is one of the causes of time in custody, as opposed to the only cause. Pettis, 275 S.W.3d at 317 (citing State ex rel. Gater v. Burgess, 128 S.W.3d 907, 910 (Mo.App. W.D.2004)). "Under section 558.031, it is to `the time in custody' that the second conviction must be related." Kelly, 58 S.W.3d at 518-19. Goings and subsequent case law relying on Goings all involve situations where the defendant requested credit on "2nd offense" sentence for time served on "1st offense" sentence after probation/parole was revoked. See, e.g., Gater, 128 S.W.3d at 910; Pettis, 275 S.W.3d 313; Monroe, 105 S.W.3d 915.
In the present case, there are three instances of time served "in custody" that Miller argues he is entitled to credit for with respect to his Case C fifteen-year prison sentence: (1) jail time prior to sentencing; (2) time served in the custody of the DOC after sentencing and while on probation for the section 217.362 drug treatment program; and (3) time served in the custody of the DOC for parole and probation violations but before probation was revoked and his Case C fifteen-year prison sentence was ordered to be executed.
In the first instance, it is undisputed that Miller served 111 days in a county jail awaiting sentencing on Case C. The "only cause" for this time in custody is the "subsequent offense" from Case C that resulted in a fifteen-year prison sentence. Thus, Miller is entitled to credit for this time served in jail prior to sentencing on Case C, and it is likewise undisputed that the DOC has, in fact, credited this time in *405 custody toward Miller's fifteen-year prison sentence.
In the second instance, Miller was sentenced on May 5, 2004, for Case C. With regard to the relevant Case C drug offense, Miller was sentenced to a fifteen-year prison sentence. However, execution of the fifteen-year prison sentence was suspended, and Miller was placed on probation. As part of the terms of probation, Miller served 581 days in the custody of the DOC until he subsequently completed the court-ordered section 217.362 drug treatment program, at which point he was released on continuing probation. Though Miller was sentenced on May 5, 2004, for the "subsequent offense" to a fifteen-year prison term, that sentence did not commence until December 7, 2007, when probation was ultimately revoked. Thus, the "only cause" for Miller's time in custody for the section 217.362 drug treatment program was the "subsequent offense" for which he ultimately began serving his fifteen-year sentence on December 7, 2007. Therefore, Miller was entitled to credit for this time served after sentencing but before his fifteen-year sentence had commenced. It is undisputed that DOC has, in fact, credited Miller for this time in custody toward Miller's fifteen-year prison sentence.
Finally, in the third instance, Miller seeks credit for his time spent in custody for parole and probation violations prior to the commencement of his fifteen-year prison sentence on December 7, 2007. Again, the facts from Miller's petition are undisputed. On February 14, 2007, Miller committed a new "subsequent offense" ("the Case D offense"). Because of Miller's arrest on the Case D offense (i.e., not an arrest related to Case C), Miller violated both the terms of his parole (i.e., Case A and Case B) and his probation (i.e., Case C). On February 16, 2007, pursuant to a parole violation warrant, Miller was arrested. Subsequently, while in custody on the parole violation warrant, Miller was served with a probation violation warrant on March 6, 2007.
It is undisputed that, upon service of the parole violation warrant and pending hearing on parole revocation, Miller was not eligible to be released on bail.[6] It is further undisputed that Miller's parole was, in fact, revoked prior to the commencement of sentencing on Miller's subsequent offense, the Case D offense, and it is likewise undisputed that Miller should, therefore, receive credit for the time he served in custody for the parole violation leading up to the time his Case D sentence commenced in May of 2008. This is, quite frankly, the factual and procedural scenario of Goings, 6 S.W.3d at 908. In other words, absent the Case D offense, Miller would have continued to have the right to be free on both the terms of his parole and his probation. But due to the Case D offense, both Miller's parole and probation were revoked, and he was entitled to credit for that time served in custody toward his Case D sentence upon the commencement of his Case D sentence.
However, in the present case, Miller is not seeking credit for time served "related to" the subsequent Case D offense. Instead, Miller is seeking credit for time served on the Case C sentence that commenced on December 7, 2007. In other words, Miller is claiming that he should be *406 entitled to credit under section 558.031.1 for the time between February 17, 2007, and December 7, 2007, because that custodial time related to both parole and probation violations.
The error in Miller's reasoning, however, is that the Case C offense was not the "subsequent offense" that returned him to custodythat "subsequent offense" was the Case D offense. Further, once Miller was arrested on the parole violation warrant, Miller was not eligible for release, no matter what the circuit court handling Miller's probation violation proceeding may or may have not been willing to do on the issue of Miller's "custody" pending probation revocation proceedings.
For time in custody to be "related to" an offense, there must be some right to be free from custody absent the subsequent offense. Kelly, 58 S.W.3d at 519; Pettis, 275 S.W.3d at 317; Belton v. Moore, 112 S.W.3d 1, 4-5 (Mo.App. W.D.2003).
Applied to our case, absent the Case D offense, Miller would have been free from custody on the terms of both his parole and probation. But, once the Case D offense occurred and Miller was arrested on February 17, 2007, on a parole violation warrant related to Case A and Case B, there is nothing that could have happened on Miller's Case C probation violation proceedings that would have resulted in Miller having a right to be free or otherwise eligible for release. Accordingly, Miller's Case C fifteen-year sentence does not qualify as a "subsequent offense" that is "related to" the time he served in custody from February 17, 2007, through December 7, 2007, and Miller is not, pursuant to the authority of section 558.031.1,[7] entitled to credit toward his Case C fifteen-year sentence.

Conclusion
Though the reasoning of the trial court on the DOC's motion to dismiss was wrong, the result was correct. Based upon the undisputed facts that Miller pleaded in his petition for declaratory judgment relief pursuant to section 558.031.1:(1) Miller has correctly received credit toward his Case C fifteen-year prison sentence for the 111 days Miller served in custody awaiting sentencing on Case C; (2) Miller has correctly received credit toward his Case C fifteen-year prison sentence for the 581 days Miller was ordered to serve in custody at a DOC-administered section 217.362 drug treatment program after sentencing on the Case C fifteen-year prison sentence but before commencement of such sentence; and (3) Miller was correctly precluded from receiving credit toward his Case C fifteen-year prison sentence for time he served without eligibility for release under the parole violation warrant he was served with and arrested for on February 17, 2007, and for which he remained in custody without eligibility for release up to and including the date his *407 Case C fifteen-year prison sentence commenced on December 7, 2007.
Accordingly, the trial court's judgment is affirmed.
THOMAS H. NEWTON and ALOK AHUJA, Judges, concur.
NOTES
[1]  All statutory references are to RSMo 2000, as amended by Cumulative Supplements, unless otherwise indicated.
[2]  On May 7, 2008, Miller pleaded guilty to the second-degree assault charge and received a two-year sentence.
[3]  Miller does not complain that his concurrent four-year sentence for possession of drug paraphernalia with intent to use in Case C was improperly credited and, thus, we do not further discuss Miller's four-year sentence.
[4]  "While traditionally an action to determine credit for jail time might be brought by a writ application ..., the Supreme Court granted relief in Goings v. Mo. Dep't of Corr., 6 S.W.3d 906 (Mo. banc 1999), which was styled as a declaratory judgment action." Monroe v. Mo. Dep't of Corr., 105 S.W.3d 915, 917 n. 1 (Mo.App. W.D.2003).
[5]  See Hoskins v. State, 329 S.W.3d 695, 698 at n. 3 (Mo. banc 2010) ("A suspended execution of sentence suspends the defendant's prison time and the defendant is put on probation....") (citing Edwards v. State, 215 S.W.3d 292, 295 (Mo.App. S.D.2007) ("When a court suspends the execution of sentence, ... the act of executing the sentence has been suspended....")).
[6]  See Section 217.720 ("At any time during release on parole or conditional release the board may issue a warrant for the arrest of a released offender for violation of any of the conditions of parole or conditional release.... Pending hearing as hereinafter provided, upon any charge of violation, the offender shall remain in custody or incarcerated without consideration of bail.").
[7]  Recognizing that credit under chapter 559 (i.e., non-custodial and custodial credit for time served under the terms of probation) is discretionary and that the circuit court deciding Miller's probation revocation and sentence execution did not invoke its discretion to award Miller any such credit, Miller does not assert that he is entitled to credit under section 559.036.3 ("The court may mitigate any sentence of imprisonment by reducing the prison or jail term by all or part of the time the defendant was on probation.") or section 559.100.2 ("The circuit court may, in its discretion, credit any period of probation or parole as time served on a sentence."). Because Miller does not rely on sections 559.036 or 559.100, and he is not entitled to credit under the statute on which he does rely (section 558.031.1) for the reasons enumerated in our ruling today, we need not and do not decide whether section 558.031.1 was otherwise inapplicable in relation to Miller's probationary status. See Donaldson v. Crawford, 230 S.W.3d 340 (Mo. banc 2007).
