当 + Clause + 时 + Main Clause
The conjunction 当 (dāng) means 'when' or 'at the time of.' It introduces a time clause that sets the scene for the main action in a sentence. The clause introduced by 当 is typically followed by 时 at the end to complete the time expression.
当我到家的时候,他已经走了。
Dāng wǒ dào jiā de shíhòu, tā yǐjīng zǒu le.
By the time I got home, he had already left.
当天开始下雨时,我们正在爬山。
Dāng tiān kāishǐ xià yǔ shí, wǒmen zhèngzài pá shān.
When it started to rain, we were climbing the mountain.
当你遇到困难时,可以随时找我帮忙。
Dāng nǐ yùdào kùnnán shí, kěyǐ suíshí zhǎo wǒ bāngmáng.
When you encounter difficulties, you can come to me for help anytime.