RTC time condition not respected by sketch program

This wont work. hour, minute and second dont have any values yet - you can't use them in a calculation before you assign values to them.
You need to put the calculation somewhere after the lines where you set the values of hour, minute and second.