It’s not necessary to attend all 3 nights, but if you do, you’ll get a greater reward. If you can attend only 1 night then attend the night of the 23rd it’s the most important one.
And yes you can attend for 2 hours only. When you go back home, try to continue worshipping Allah. You only get this chance once a year, so make the best of it by repenting, supplicating, reading Qur’an, and reading Dua Jawashan al-Kabir.