
388 S.C. 314 (2010)
696 S.E.2d 597
The STATE, Respondent,
v.
William Randolph BOGGS, Appellant.
No. 4704.
Court of Appeals of South Carolina.
Submitted June 1, 2010.
Decided June 30, 2010.
*315 Appellate Defender Elizabeth A. Franklin-Best, of Columbia, for Appellant.
Attorney General Henry Dargan McMaster, Chief Deputy Attorney General John W. McIntosh, Assistant Deputy Attorney General Salley W. Elliott, Senior Assistant Attorney General Harold M. Coombs, Jr., all of Columbia; and Solicitor Jerry W. Peace, of Greenwood, for Respondent.
PER CURIAM:
William Randolph Boggs pled guilty to strong arm robbery. Prior to being sentenced, he requested credit for the time he served in pretrial detention. The plea judge indicated his desire that Boggs not receive credit, and on the sentencing sheet, the plea judge did not check the box that would give Boggs credit for time served. Boggs appeals, arguing he is entitled to receive credit for the time he served pursuant to section 24-13-40 of the South Carolina Code (2007). We agree and modify the sentence to include credit for time served.[1]

FACTS
Boggs was charged with armed robbery, and he exercised his right to a jury trial. After the trial was underway, the State agreed to allow Boggs to plead guilty to strong arm robbery. Boggs pled guilty and requested credit for the sixteen-and-a-half months he was detained pretrial.
In response to this request, the plea judge acknowledged being "well aware that section 24-13-40 says you get credit for the time that you were held awaiting sentencing;" however, the judge explained that he was going to request on the sentencing sheet that Boggs not receive credit for time served. Boggs's attorney argued section 24-13-40 was mandatory, to which the judge replied: "I only said request[;] I don't put that in there that he is not to get it[.] He is entitled to it by *316 statute. . . . I am aware of all of that. But when I don't check it off[,] they don't give him credit[.] I am just telling you how it works in the real world."
The plea judge sentenced Boggs to the maximum sentence of fifteen years. On the sentencing sheet, the judge did not check the box notifying the Department of Corrections that Boggs was to be given credit for time served. Instead, the judge hand wrote on the sentencing sheet: "request that Def not be given credit for time served as charge dropped from ar. robbery to st. ar. robbery." This appeal followed.

LAW/ANALYSIS
Section 24-13-40 of the South Carolina Code (2007) mandates prisoners receive credit for the time they served prior to trial unless one of two exceptions exist, either: (1) the prisoner was an escapee or (2) the prisoner was already serving a sentence on a different offense. Because the language of section 24-13-40 is mandatory, a judge cannot deny a defendant credit for time served prior to trial unless one of the two exceptions applies. See State v. McCord, 349 S.C. 477, 487, 562 S.E.2d 689, 694 (Ct.App.2002).
Although the State acknowledges Boggs should receive credit for the sixteen months he was detained pretrial, the State argues that the plea judge did not commit an "error of law" because the judge merely made a "precatory request" that Boggs would not get credit. We find the plea judge's own comments undermine the State's assertion that the request had little significance: "But when I don't check [off the box,] they don't give him credit[.] I am just telling you how it works in the real world." Indeed, the online records of the South Carolina Department of Corrections indicate Boggs has not been given credit for time served because his fifteen-year sentence began to run on April 7, 2008, the day of his guilty plea, not the day he was first detained on the charge.
We find the plea judge committed an error of law when he denied Boggs credit for time served based upon the State's decision to drop the charge from armed robbery to strong arm robbery. A judge's disappointment in the maximum sentence he can impose is not one of the exceptions to the mandatory language in section 24-13-40. Accordingly, the trial judge's *317 decision to deny Boggs credit for time served is reversed.[2] The Department of Corrections shall calculate the credit he is due pursuant to section 24-13-40.
REVERSED.
NOTES
[1]  We decide this case without oral argument pursuant to Rule 215, SCACR.
[2]  Boggs did not appeal his conviction or fifteen-year sentence.
