How to code a RTC to run a code from 11:30pm to 5:30am?

How would i incorporate the time functions to run it during those times, and include the RTC after

First, learn to use the Time library. There are many examples on line. It works and will do what you want, but does not keep accurate time. You don't need to keep accurate time for a demonstration project anyway.

When you understand how to use the Time library, you can simply connect the RTC to the Arduino, set the RTC time and date, then use the "setSyncProvider" function to tell the Time library to use the RTC for more accurate timekeeping.

Note: The DS1307 is not very accurate, either. Most people use the DS3231.