The operating rooms within the surgical unit take center stage in a hospital. The fact that, in practice, actual durations of surgery do not coincide with their allotted times yields extra costs; for example, earliness results in unutilized operating room time, and lateness incurs extra waiting for patients. Various machine learning methods are employed to predict surgery times in a hospital. The data used stems from the Shahid Chamran Trauma educational-medical hospital (Shiraz, Iran) from 2018 until 2021. The performances across the four methods, linear regression, recursive partitioning, support vector machine, and XGBoost, are compared using established accuracy and relevant healthcare operational metrics. The predicted surgery times vary per algorithm, but the differences are minor. Among the methods, linear regression shows the best performance. Linear regression, which also provides explanatory insights, outperforms the other approaches for predicting surgery times. Furthermore, the study shows that using machine learning models is a promising avenue to improve the prediction of operation time and generate more efficient and effective operating room schedules.