It comes from "Poems to Encourage Learning" written by Yan Zhenqing in the Tang Dynasty.
The meaning of this poem is: From midnight to the time when the rooster crows every day, it is the best time for boys to study.
"Encouraging Learning" is an ancient poem written by Yan Zhenqing, a poet of the Tang Dynasty. Encourage young people to cherish their youth. When they are young, they must know how to study hard, study diligently, and make a difference. Otherwise, it will be too late to study when they are old. It will be too late to regret. They should cherish their time. Let children initially understand that life is short, thereby increasing their enthusiasm for learning.