
775 P.2d 762 (1989)
108 N.M. 560
STATE of New Mexico, Plaintiff-Appellee,
v.
Willie HOWARD, Defendant-Appellant.
No. 11082.
Court of Appeals of New Mexico.
April 11, 1989.
Certiorari Denied May 10, 1989.
Hal Stratton, Atty. Gen., William McEuen, Asst. Atty. Gen., Santa Fe, for plaintiff-appellee.
Jacquelyn Robins, Chief Public Defender, Susan Gibbs, Appellate Defender, Santa Fe, for defendant-appellant.

OPINION
MINZNER, Judge.
Defendant appeals the enhancement of his sentence pursuant to the habitual offender statute, NMSA 1978, Section 31-18-17 (Repl.Pamp. 1987). Defendant was convicted of three offenses and given consecutive sentences. The state filed a supplemental information, alleging that defendant had been convicted of one prior felony. Following a hearing on the allegation, the trial court enhanced each of the three underlying sentences by one year. The court denied defendant's motion to have the enhancements run concurrently. He appealed, contending (1) there was insufficient evidence to support a determination that he is a habitual offender. Defendant also argues that this court has inconsistently interpreted the habitual offender statute, Section 31-18-17, the firearm enhancement statute, NMSA 1978, Section 31-18-16 (Repl.Pamp. 1987), and the credit for presentence confinement statute, NMSA 1978, Section 31-20-12 (Repl.Pamp. 1987). Thus, he contends (2) that the trial court erred in enhancing each of the underlying sentences. We affirm.
In determining whether the evidence supports a criminal charge or an essential element thereof, this court must view the evidence in the light most favorable *763 to the state. State v. Lankford, 92 N.M. 1, 582 P.2d 378 (1978). This court does not weigh the evidence and may not substitute its judgment for that of the trier of fact. Id. For a sentence to be enhanced under Section 31-18-17, there must have been a felony conviction prior to the commission of the offense for which the enhanced sentence is sought. See State v. Linam, 93 N.M. 307, 600 P.2d 253, cert. denied, 444 U.S. 846, 100 S.Ct. 91, 62 L.Ed.2d 59 (1979).
In this case, Dusty Rhodes, a deputy with the Lea County Sheriff's Office in 1975 and 1976, testified that defendant was the same man who was charged and convicted in Lea County cause number 4907. Ron White, a detective in Lovington in 1975 and 1976, testified that he investigated the case described in state's exhibit number 1, which exhibit appears to have been photostats of the criminal information and judgment and sentence in cause number 4907. White further testified that the "Willie Howard" charged and convicted in cause number 4907 is the same man as defendant. Danny Escobedo, a detective with the Lovington police, testified that he investigated a case involving defendant, which resulted in the filing of a criminal information in Lea County cause number CR88-4, state's exhibit number 2. The state established that defendant was convicted of the three counts contained in state's exhibit number 2 by presenting a copy of the judgment and sentence filed in cause number CR88-4.
This evidence is sufficient to support the trial court's finding that defendant is the same person convicted in Lea County cause numbers 4907 and CR88-4. Therefore, there is sufficient evidence to support a determination that defendant is a habitual offender and subject to Section 31-18-17(B).
Section 31-18-17(B) enhances by one year the "basic sentence" for any person convicted of a noncapital felony who has incurred one prior felony conviction. We have indicated that the term "a noncapital felony" in this section is the equivalent of "any felony." See State v. Harris, 101 N.M. 12, 677 P.2d 625 (Ct.App. 1984). Thus, this statute, as we have interpreted it, requires that the sentence for each of defendant's current multiple felonies be enhanced on the basis of the prior felony conviction. Id.
Section 31-20-12, on the other hand, provides that when a person has been officially confined on suspicion or charges of a felony, that person shall be given credit for the period spent in presentence confinement if he or she is ultimately convicted of that offense or a lesser included one. The credit shall be given against "any sentence finally imposed." We have held that the term "any sentence finally imposed" in this section refers to the total time to which defendant is sentenced. State v. Aaron, 103 N.M. 138, 703 P.2d 915 (Ct.App. 1985). Thus, defendant is not entitled to credit for presentence confinement against each underlying sentence imposed for the current felonies. Id.
Defendant argues that because similar language is used in both statutes, the interpretation should be the same. He contends that the terms "a noncapital felony" and "basic sentence" in Sections 31-18-17 and -16 should be given the same meaning as "a felony" and "any sentence finally imposed" in Section 31-20-12. Defendant does not argue that the statutes are ambiguous, nor does he argue that the construction of these statutes by this court does not give effect to the intent of the legislature. He merely states that fairness requires the two statutes to be read consistently. If defendant only gets presentence confinement credit against the total sentence, see State v. Aaron, he urges us to overrule Harris and conclude that only the total sentence should be enhanced.
There are two answers to defendant's argument. First, we believe the argument requires that we take individual words out of context. Defendant reasons that the phrase "a felony" requires a consistent interpretation, yet that is not the only relevant phrase. It is not clear that the phrase "basic sentence," as used in the enhancement statutes, is the equivalent of the phrase "any sentence ultimately imposed" used in the presentence confinement credit *764 statute. If, in fact, the statutes do not contain the same or similar language, defendant's argument lacks a factual basis.
Further, in applying statutes, this court must ascertain and give effect to the intention of the legislature. See Arnold v. State, 94 N.M. 381, 610 P.2d 1210 (1980). Legislative intent is to be determined primarily from the language used in the statute. Id.
A statute should be interpreted and construed in light of the purpose for which it was enacted. See State v. Rodriguez, 101 N.M. 192, 679 P.2d 1290 (Ct.App. 1984). Whether interpreting or construing a statute, we must read it in its entirety and with regard to its apparent intent. See Security Escrow Corp. v. State Taxation & Revenue Dep't, 107 N.M. 540, 760 P.2d 1306 (Ct.App. 1988). The interpretation or construction given each of these statutes by this court is consistent with the language used by the legislature and with the legislature's apparent purpose in enacting it. Compare State v. Harris and State v. Kendall, 90 N.M. 236, 561 P.2d 935 (Ct. App.) (firearm enhancement statute discussed), overruled on other grounds, 90 N.M. 191, 561 P.2d 464 (1977) with State v. Aaron. Each of these opinions considered the language of the relevant statute in light of its purpose. Id. Thus, we are not persuaded that Harris and Kendall erroneously applied the enhancement statutes.
The purpose of Section 31-20-12 is to give some relief to persons who, because of an inability to obtain bail, are held in custody. See Commonwealth v. Carter, 10 Mass. App. Ct. 618, 411 N.E.2d 184 (1980). While it does not insure that an indigent offender will serve no more time in confinement than an otherwise situated offender who furnished bail, see State v. Aqui, 104 N.M. 345, 721 P.2d 771 (1986), it does recognize a problem and provide a partial solution. If a defendant is confined on charges and subsequently convicted and sentenced on those charges, the time he was held in presentence confinement is treated as time served against the sentence.
We do not believe the legislature intended to give a defendant credit for additional time, when charged with and convicted of multiple offenses arising from a single criminal action. The court must give effect to legislative intent that will avoid absurd, unreasonable, or unjust results. State v. Aaron.
Thus, Section 31-20-12 has been construed to mean that a defendant is entitled to one day's credit against his total sentence for each day spent in presentence confinement. Regardless of whether the sentences for the multiple felonies are to run concurrently or consecutively, credit is given only for that period actually spent in presentence confinement. See State v. Aaron. This interpretation of the credit for presentence confinement statutes is supported by a majority of states, which give presentence confinement credit against the total sentence. See Endell v. Johnson, 738 P.2d 769 (Alaska Ct. App. 1987). We agree with the Alaska Court of Appeals. "A contrary interpretation of [the presentence confinement credit statute] would be incompatible with the basic purpose of consecutive sentencing and might tend to defeat the intent of sentencing judges." Id. at 771.
The purpose of Section 31-18-17 is to deter future crimes. State v. Linam. Enhancement of the basic sentence for each felony conviction effects that deterrent purpose. The fact that some deterrent purpose would be served by enhancing only the total sentence is not dispositive of the legislature's intent in drafting Section 31-18-17.
Defendant argues that because habitual criminality is a status rather than an offense, Lott v. Cox, 75 N.M. 102, 401 P.2d 93 (1965), the status is not dependent on the number of current crimes that are committed together. He reasons that a criminal is not deterred from committing a current crime because it may be divided into many parts for purposes of punishment.
It is true that defendant's status as a habitual criminal depends not on current crimes but on prior crimes. However, the punishment for habitual criminality applies to current crimes. The intent of the statute is to provide an increased penalty in *765 order to deter the commission of a subsequent offense. State v. Linam.
The legislature establishes penalties for criminal behavior. State v. Mabry, 96 N.M. 317, 630 P.2d 269 (1981). The statute setting the penalty for habitual criminality is clear in stating that a person convicted of a felony, who has incurred a prior felony conviction, will have his basic sentence enhanced by one year. We think in choosing the term "basic sentence" the legislature referred to the sentence to be enhanced. If a person with a prior felony conviction is convicted of multiple felonies, then there are several basic sentences. Thus, there may be multiple enhancements. State v. Harris. Even if the reference to "basic sentence" in this statute was ambiguous, we are not persuaded that this court erred in construing the legislature's intent. Thus, we decline to overrule our decision in Harris.
The evidence supports a finding that defendant is a habitual offender; the trial court could properly enhance each of his three convictions by one year. Defendant's sentence is affirmed.
IT IS SO ORDERED.
BIVINS, C.J., and ALARID, J., concur.
