
208 Va. 105 (1967)
C. C. PEYTON, SUPERINTENDENT OF THE VIRGINIA STATE PENITENTIARY
v.
JERRY E. CHRISTIAN.
Record No. 6432.
Supreme Court of Virginia.
June 12, 1967.
Present, All the Justices.
1.  Petitioner sentenced in 1944 to four years in Penitentiary on sentence declared in 1965 to be void.  While serving 1944 void sentence, petitioner was convicted in 1945 of another crime and sentenced to sixteen years.  No credit for time served on void sentence prior to 1945 valid conviction.
2.  Under Code | 53-207 term of confinement computed from date of valid sentence.
3.  Principles of justice dictate that credit be given for time served on void sentence after date of valid conviction since nothing to postpone commencement of valid sentence at time it was pronounced.
Error to a judgment of the Law and Equity Court of the City of Richmond, Hon. Robert Lewis Young, judge presiding.
Reno S. Harp, III, Assistant Attorney General (Robert Y. Button, Attorney General,    on brief), for plaintiff in error.
Frank A. S. Wright    for defendant in error.
BUCHANAN
BUCHANAN, J., delivered the opinion of the court.  *106 
Jerry E. Christian, petitioner, filed a petition for a writ of    habeas corpus ad subjiciendum    in the Law and Equity Court of the City of Richmond on September 23, 1965, alleging that he was being illegally detained by C. C. Peyton, Superintendent of the Virginia State Penitentiary, respondent.  He averred that on September 9, 1965, by an order of the Circuit Court of the City of Chesapeake, a sentence of four years in the penitentiary imposed on petitioner by the Circuit Court of Norfolk county on November 10, 1944, had been declared void, and that he was entitled to credit for part of the time served on the void sentence on a sentence of sixteen years imposed upon him on March 27, 1945, by the Hustings Court of the City of Portsmouth for robbery, which credit he said had been denied him.
Respondent filed a motion to dismiss on the ground that the petitioner was not entitled to credit for any time served by the petitioner under the sentence declared void.  By order of October 8, 1965, the court directed that the writ be issued returnable to October 19, 1965.
Upon the hearing of the matter it was stipulated that the petitioner's prison record, exhibited with respondent's motion, correctly set forth the facts and if petitioner started to serve the sentence of sixteen years imposed by the Hustings Court of the City of Portsmouth for robbery, as of the date of the entry of said judgment on March 27, 1945, then petitioner had fully served all sentences imposed upon him.
Upon consideration the court concluded that the petitioner started serving the sentence of March 27, 1945, on that day in accordance with | 53-207 of the Code, * and pursuant to the stipulation ordered that the respondent forthwith discharge petitioner from his custody.  Respondent has appealed from that order, and petitioner was released on bail.  Code | 8-607.
*  | 53-207:  "Term commences from date of judgment. -- The term of confinement in jail or in the penitentiary for the commission of a crime shall commence and be computed from the date of the final judgment, which, in case of an appeal, shall be that of the refusal of a writ of error or the affirmance of the judgment."
(See    Wilkinson     Youell,    180 Va. 321, 23 S.E.2d 356, and    Peyton
Williams,    206 Va. 595, 145 S.E.2d 147, with reference to the application of this section.)
Subsequent to petitioner's sentence of four years by the Circuit Court of Norfolk county on November 10, 1944, and his sentence of sixteen years by the Hustings Court of the City of Portsmouth on March 27, 1945, he received various sentences for various crimes as listed in his prison record dated September 24, 1965, which stated that the petitioner was then serving a term of one year imposed by the Circuit Court of Augusta county on June 4, 1953, for housebreaking.  *107 The record further indicated that petitioner would complete the serving of all sentences against him on July 4, 1966.
We are not here concerned, however, with any of these sentences subsequent to the sentence of November 10, 1944, and the sentence of March 27, 1945, because of the stipulation set out in the order appealed from "that if petitioner started to serve the sentence of sixteen years for robbery imposed by the Hustings Court of the City of Portsmouth as of the day of entry of said judgment on March 27, 1945, then petitioner was fully served all sentences imposed against him."
The prison record shows that the petitioner was first convicted on November 10, 1944, and was sentenced to serve a term of four years in the penitentiary. His term therefore began on that day.  Code | 53-207,    supra.
After petitioner had begun to serve that sentence, he was, on March 27, 1945, convicted of robbery and sentenced to serve sixteen years in the penitentiary.  Ordinarily he would have begun to serve that sentence at the expiration of his sentence of November 10, 1944.  Code | 19.1-294;    Smyth Midgett,    199 Va. 727, 101 S.E.2d 575;    Grace     Peyton,    207 Va. 688, 692-3, 152 S.E.2d 292, 295.
But the petitioner should not have been serving the 1944 sentence.  That was a void sentence, so determined by the Circuit Court of the City of Chesapeake (formerly the Circuit Court of Norfolk county) by order entered September 9, 1965, which declared it "void    ab initio."
  A void judgment is in legal effect no judgment.  "'By it no rights are divested.  From it no rights can be obtained.  * * *'"    Anthony     Kasey, 83 Va. 338, 340, 5 S.E. 176, 177.
  Petitioner cannot have, and does not here request, any credit on his March 27, 1945, sentence for the time he had then served on the void sentence of 1944.     Smyth v. Midgett, supra,    199 Va. 727, 730, 101 S.E.2d 575, 578, and cases there cited.  But at the date of his 1945 sentence, when he was being improperly held on a void sentence, there was no reason why the provision of | 53-207 should not be applied and the term of his confinement be computed from the date of that sentence, March 27, 1945.  When so applied, then according to the stipulation petitioner has fully served all sentences imposed against him and is entitled to be discharged from custody.
Respondent argues that this conclusion is contrary to our holdings in Smyth     Midgett, supra; Smyth     Holland,    199 Va. 92, 97 S.E.2d 745, and
McDorman     Smyth,    187 Va. 522, 47 S.E.2d 441.  Those *108 cases do not decide the point involved in the present case and the conclusion here reached is supported by some of the holdings in those cases.
In    Smyth     Midgett, supra,    the question was whether a prisoner should have credit "on valid sentences, which he had not begun to serve when the petition [for    habeas corpus   ] was filed, for time he had served on void sentences."  We held that he should not, stating that "where a prisoner is being detained under a valid sentence he is not entitled to credit for time served on a void sentence fully served before the proceeding for writ of    habeas corpus"
is instituted."  But "if he is being detained under a void sentence, he is entitled to credit for the time served under such sentence on a valid sentence, or sentences, entered against him prior to the time he began serving the void sentence.     Fitzgerald     Smyth,    194 Va. 681, 74 S.E.2d 810; McDorman     Smyth,    188 Va. 474, 50 S.E.2d 423.""
We held, therefore, that Midgett was entitled to credit "on the three valid escape convictions for the time served since May 2, 1955, the date he began serving the void sentence under which he was being detained at the time he filed his petition for a writ of    habeas corpus."
In    McDorman     Smyth, supra,    as pointed out in    Midgett, McDorman attacked the validity of a sentence pronounced against him on March 9, 1932, as a third offender, which he began serving on May 24, 1948.  Because one of the former convictions was void, we held that his conviction as a third offender was also void; but there was pending against him a valid sentence of one year in the penitentiary for escape that he had not begun to serve.  We held that he was entitled to credit on his escape conviction for time served under the void third offender conviction for which he was then being held.
  The principle of justice that dictated the allowing of credits on the valid sentences to Midgett and McDorman for part of the time served by them on void sentences is clearly applicable under the facts in the present case.  At the time petitioner was sentenced to the term of sixteen years on March 27, 1945, he was being detained under the void sentence of 1944.  Since there was, in legal contemplation, nothing to postpone the commencement of the 1945 sentence at the time it was pronounced, the trial court properly held that the latter sentence began to run from the date of the final judgment, and that term having now been served, petitioner, pursuant to the stipulation, was entitled to be released from detention.
The judgment of the trial court is therefore
Affirmed.
