When do I prepare for immersion, by day or at night?
Close to the immersion. The custom is to begin by day and continue until it gets dark, and then to immerse.
In a pressing situation, the preparation can be done entirely by day or entirely at night, provided it is not rushed.
Sources
- Shulchan Arukh, Yoreh De'ah 199:3
חפיפה צריכה להיות לכתחלה סמוך לטבילתה
Levana shows; it does not rule. The decision stays with your rabbi.

