If you're a morning person, I'd suggest going there for sunrise because it's a lot less crowded. However, if you're keen on watching the sunset, I'd suggest going there Thursday to Saturday between 20:00 and 00:00
because those are the timings when the Sagrada Familia will be lit up
. Watching the sun go down and the lights come up all over the city, and witnessing the Sagrada Familia sparkle like a gem in the dark, will make Barcelona's night view all the more memorable.