delivered the opinion of the court:
Plaintiff, John Doe, appeals the order of the circuit court granting summary judgment in favor of defendant Dr. Robert Channon on plaintiffs claim of false imprisonment based on plaintiffs involuntary admission to the psychiatric unit at Northwestern Memorial Hospital from March 7 to March 9, 1997. On appeal, plaintiff contends the trial court erred in granting summary judgment because Dr. Channon unlawfully restrained (i.e., falsely imprisoned) plaintiff in violation of section 3 — 610 of the Mental Health and Developmental Disabilities Code (Code) (405 ILCS 5/3 — 610 (West 1996)) by failing to release plaintiff from the psychiatric unit “forthwith” after determining that plaintiff was not subject to involuntary admission. We affirm.
On Friday, March 7, 1997, plaintiff appeared in court for a hearing on a divorce and child custody matter. During the hearing, plaintiff became so disruptive that the trial court entered an order that plaintiff “be transported to Northwestern Hospital by the Cook County sheriff for a psychiatric evaluation as to his mental status.”
At the hospital, a mental health worker prepared a petition for plaintiff’s involuntary admission under section 1 — 119 of the Code. Section 1 — 119 defines a person “subject to involuntary admission” as a person with mental illness who because of his illness is reasonably expected to inflict serious physical harm upon himself or another in the near future. 405 ILCS 5/1 — 119 (West 1996).
Dr. Tom Nutter, a resident in psychiatry, prepared a certificate in support pursuant to section 3 — 602 of the Code. Section 3 — 602 requires that the petition be accompanied by a certificate executed by a physician, qualified examiner, or clinical psychologist which states that the respondent is subject to involuntary admission and requires immediate hospitalization. 405 ILCS 5/3 — 602 (West 1996).
Dr. Channon, a psychiatrist on staff at Northwestern, examined plaintiff on Saturday, March 8, 1997, pursuant to section 3 — 610 of the Code. Section 3 — 610 states that a psychiatrist must examine the respondent no later than 24 hours (excluding Saturdays, Sundays, and holidays) after he is admitted. 405 ILCS 5/3 — 610 (West 1996). The psychiatrist who conducts this examination must execute a second certificate and may not be the same individual who executed the first certificate. 405 ILCS 5/3 — 610 (West 1996). Section 3 — 610 further *712states that, if no examination occurs within 24 hours of admission or if the examining psychiatrist does not execute a certificate, “the respondent shall be released forthwith.” 405 ILCS 5/3 — 610 (West 1996).
Dr. Channon testified in an affidavit that after examining plaintiff, he made the determination that “further observation and inpatient treatment of [plaintiff] was warranted to ensure that the aggressive and threatening behavior he had exhibited the previous day was under sufficient control that he would be able to maintain his composure upon release. It was my opinion at the time of this examination that [plaintiff] was a potential danger to others and that his immediate discharge was not appropriate.”
Dr. Channon’s notes for March 8, 1997, further detailed his findings:
“Yesterday on the unit and today [plaintiff] has been making many phone calls to [his brother], parents, [outpatient] psychiatrist and therapist and me. He has been very anxious to leave the hospital. He has not threatened me but he has been almost frantic in trying to contact [hospital] administrators, etc. and [outpatient psychiatric] professionals. He believes he was managing fine until court order re custody yesterday. His family reports, however, he has been feeling like everyone is against him. He denies suicidal or homicidal ideation. He claims he is motivated to take meds and recognizes need to have an [attorney] for divorce and custody. He is not overtly psychotic; he does display narcissistic personality traits but has not been aggressive or threatening. Mild to moderately restless; periodically on verge of tears.”
Dr. Channon further wrote that he anticipated plaintiffs discharge the next morning “if he maintains composure.” After examining plaintiff again on March 9, 1997, Dr. Channon approved plaintiffs discharge.
Approximately one year later, plaintiff filed a false imprisonment suit against Dr. Channon. Plaintiff alleged that after examining plaintiff on March 8, Dr. Channon was required under section 3 — 610 to either execute a second certificate or release plaintiff “forthwith.” Dr. Channon failed to execute the second certificate, yet he held defendant in the psychiatric unit until the following morning (March 9) before releasing him. Plaintiff alleged that Dr. Channon unlawfully restrained plaintiff by failing to release him “forthwith” on March 8.
Plaintiffs false imprisonment claim against Dr. Channon was assigned for trial. Dr. Channon filed a motion in limine asking the court to interpret section 3 — 610 as allowing Dr. Channon one business day after plaintiffs involuntary admission (i.e., until Monday, March 10, *7131997) to issue the second certificate or release plaintiff. The trial court agreed with Dr. Channon’s interpretation of section 3 — 610 and suggested that Dr. Channon seek summary judgment based on its ruling. Dr. Channon so moved, contending plaintiff could not establish that his hospitalization was unlawful under the trial court’s interpretation of section 3 — 610. The trial court granted Dr. Channon’s summary judgment motion and plaintiff filed this timely appeal.
Summary judgment is appropriate when, viewed in the light most favorable to the nonmoving party, the pleadings, depositions, and admissions on file reveal that no genuine issues of material fact exist and that the moving party is entitled to judgment as a matter of law. Ragan v. Columbia Mutual Insurance Co., 183 Ill. 2d 342, 349 (1998). The standard of review in cases involving summary judgment is de novo. Ragan, 183 Ill. 2d at 349.
To state a cause of action for false imprisonment, plaintiff must allege that his personal liberty was unreasonably or unlawfully restrained against his will and that Dr. Channon caused or procured the restraint. See Arthur v. Lutheran General Hospital, Inc., 295 Ill. App. 3d 818, 825-26 (1998), Imprisonment under legal authority is not false imprisonment. Arthur, 295 Ill. App. 3d at 826.
Dr. Channon claims that there was no false imprisonment here, as he acted pursuant to the legal authority set forth in the Code. Thus, to determine whether the trial court erred in granting summary judgment on plaintiffs false imprisonment claim, we must examine the pertinent sections of the Code. The primary rule of statutory construction is to ascertain and give effect to the intent of the legislature. In re Moore, 301 Ill. App. 3d 759, 765 (1998). In determining legislative intent, the statute must be read as a whole and all relevant parts must be considered. In re Moore, 301 Ill. App. 3d at 765.
Read together, sections 3 — 602 and 3 — 610 provide that a respondent may be involuntarily hospitalized for 24 horn’s pursuant to a petition for involuntary admission and an accompanying certificate executed by a physician, qualified examiner, or clinical psychologist. 405 ILCS 5/3 — 602, 3 — 610 (West 1996). Section 3 — 610 provides that the respondent may be involuntarily hospitalized for longer than 24 hours only if a psychiatrist examines the respondent within the 24-hour period after his admission and executes a second certificate. 405 ILCS 5/3 — 610 (West 1996). The psychiatrist may execute the second certificate only if he finds that the respondent is mentally ill and reasonably expected to inflict serious physical harm on himself or another in the near future. 405 ILCS 5/1 — 119 (West 1996).
If, within the 24-hour time frame, the psychiatrist examines the respondent and decides not to execute the second certificate, then the *714respondent must be released from the hospital “forthwith.” 405 ILCS 5/3 — 610 (West 1996).
Here, plaintiff was involuntarily admitted to Northwestern on Friday afternoon, March 7, 1997. As section 3 — 610 of the Code excludes Saturday and Sunday when computing the 24-hour time frame within which the psychiatric examination must be conducted, Northwestern had until the following Monday afternoon, March 10, 1997, to have a psychiatrist examine plaintiff and execute a second certificate for his continued detainment.
Dr. Channon examined plaintiff at about 6 p.m. on Saturday, March 8, 1997, within the 24-hour time frame provided by the Code. Dr. Channon was unable to make an immediate determination as to whether to execute the second certificate, noting that further observation was necessary “to ensure that the aggressive and threatening behavior [plaintiff] had exhibited the previous day was under sufficient control that he would be able to maintain his composure upon release.” Accordingly, Dr. Channon ordered plaintiff to be held overnight at Northwestern.
Plaintiff argues that his overnight detention was unlawful, as Dr. Channon was required to release him “forthwith” after the Saturday night (March 8) examination. We disagree. Under the Code, Dr. Chan-non was required to release plaintiff “forthwith” only after determining that plaintiff was not a threat to inflict serious physical harm to himself or others and, thus, that a second certificate would not issue. See 405 ILCS 5/3 — 610, 1 — 119 (West 1996). Since Dr. Channon was unable to make that determination in the immediate aftermath of the Saturday evening (March 8) examination, plaintiff’s “forthwith” release was not required, and plaintiff could lawfully continue to be detained for the remainder of the 24-hour detention period provided for pursuant to the first certificate. In sum, plaintiffs continued overnight detention was lawful, as the 24-hour detention period provided for pursuant to the first certificate executed by Dr. Nutter had not yet expired.
Dr. Channon examined plaintiff again at about 9:40 a.m. on Sunday, March 9, 1997 (still within the 24-hour period provided by the Code), determined that he was not going to execute a second certificate, and approved plaintiffs discharge “forthwith.” Plaintiff was never unlawfully detained under the Code, and accordingly, the trial court did not err in granting summary judgment for Dr. Chan-non.
Plaintiff argues that Sassali v. DeFauw, 297 Ill. App. 3d 50 (1998), In re Rovelstad, 281 Ill. App. 3d 956 (1996), and In re Ellis, 284 Ill. App. 3d 691 (1996), compel a different result.
*715In Sassali, the appellate court held that an initially authorized detention under the Code can become a false imprisonment when there is a failure to comply with the filing requirement for the commitment procedure. Sassali, 297 Ill. App. 3d at 52-54. Here, as discussed, Dr. Channon did not fail to comply with the requirements for the commitment procedure; accordingly, Sassali is inapposite.
In Rovelstad, the respondent appealed two orders entered by the trial court pursuant to the Code. The first ordered him involuntarily admitted to St. Joseph’s Hospital for 30 days. The second ordered the extension of his hospitalization for an additional 30 days. Rovelstad, 281 Ill. App. 3d at 959. The appellate court reversed, holding that the State had failed to show that a psychiatrist examined respondent within 24 hours of his admission as required by section 3 — 610 of the Code. Rovelstad, 281 Ill. App. 3d at 965. Further, the court noted that no second certificate was ever executed, as required by section 3 — 610 to hold defendant for longer than 24 hours. Rovelstad, 281 Ill. App. 3d at 966. The court rejected the State’s argument that its violation of section 3 — 610 was a mere technical deficiency; the court held that because “involuntary admission proceedings pose a grave threat to an individual’s liberty interests, the Code’s procedural safeguards should be strictly construed in favor of the respondent.” Rovelstad, 281 Ill. App. 3d at 965.
Rovelstad is inapposite, as Dr. Channon examined plaintiff within 24 hours of his admission and released plaintiff “forthwith” after deciding not to execute the second certificate. Even strictly construing the Code’s procedural safeguards in favor of plaintiff, Dr. Channon did not violate section 3 — 610.
In Ellis, the appellate court reversed the order involuntarily admitting respondent to a mental health facility because respondent was not examined within 24 hours of her admission as required by section 3 — 610. Ellis, 284 Ill. App. 3d at 694. Ellis is inapposite, as Dr. Chan-non examined plaintiff within 24 hours of his involuntary admission and otherwise complied with all of the Code’s procedural requirements for involuntary admission. See our discussion above.
Next, plaintiff cites section 3 — 610’s legislative history. We need not examine the legislative history, as the statutory language is not ambiguous or unclear. Armstrong v. Hedlund Corp., 316 Ill. App. 3d 1097, 1106 (2000). Nevertheless, we have examined section 3 — 610’s legislative history and found nothing therein addressing the issues on appeal.
Next, plaintiff argues that the trial judge’s grant of summary judgment was error, as it conflicted with an earlier interlocutory order made by another trial judge denying Dr. Channon’s motion to dismiss. *716We find no error, as the trial court determined that the prior interlocutory ruling on the motion to dismiss was erroneous as a matter of law and, thus, was subject to revision or modification. See, e.g., Bailey v. Allstate Development Corp., 316 Ill. App. 3d 949, 957 (2000) (When an interlocutory ruling is erroneous as a matter of law, the successor court may modify or revise that ruling at any time prior to final judgment).
Plaintiff also argues that the trial judge erred in granting Dr. Channon’s motion for summary judgment when a prior summary judgment motion was denied by a different judge. We disagree. An order denying summary judgment may be modified or vacated at any time before final judgment. Watts v. City of Chicago, 325 Ill. App. 3d 288, 291 (2001).
For the foregoing reasons, we affirm the circuit court.
Affirmed.
TULLY and GALLAGHER, JJ., concur.