the solar eclipse is a post-hardmode event which will occur after at least one mechanical boss (The Destroyer, The Twins or Skeletron Prime) has been defeated at least once.
To summon it without waiting or defeating them is entering the "Lihzahrd Temple"
and getting solar tablet fragments. 8 solar tablet fragments make a solar tablet
that manually starts the solar eclipse.
Solar Eclipse page made by @TheRealEnchantedStar\
I hope I helped! =D