These rays most commonly happen in the twilight hours, just before sunrise and after sunset, around mountains and cloud coverage. However, they can also form throughout the day if the cloud is structured a certain way.
Having the nickname “God’s rays,” this atmospheric phenomenon lives up to that. If you ever happen to see some crepuscular rays, I recommend taking a few photos as you will not see them very often. Not only are they rare, but they are gorgeous.