Might be a stupid question.

So I bought some Miconazole for a yeast infection and it says apply before bed. Do I have to be going right to bed to use it or can I use it after a shower and still do things before bed? Also how many hours does it stay in?