When: とき, 前に and 後で

とき after a plain form, or a noun and の, says when, 子どものとき, 前に after the plain present says before, 寝る前に, and 後で after the plain past says after, 食べた後で.

From Japanese 2.