From the moment an enemy decides to attack you a message will appear on your main page telling you an attack is coming.
Depending on how far away they are you may get several hours notice. Check unit movement, some move at 16 fields an hour, it would take 16 hours for me to attack Krys (if only I could
) plenty of time for him to notice and plan how to spend his resources/send his troops out scouting.