RTC and Interval Timing

Please provide a link the the DS3231 library you are using. There are several libraries with the same name, but with different syntax for using the hardware rtc chip.

From your sketch it does not look like you are actually using the rtc module for anything other than the temperature. All of the time commands are using the syntax of the time library. You will need to link the rtc time to the arduino clock time. Without knowing the library you are using, I can't help with the setSyncProvider code to do that.

Your compiling error is due to using the wrong syntax for the time commands. You need minute().

void fanTimer(){
      if ( minute() >= 0 && minute() < 5)
{
  digitalWrite ( RELAY2, HIGH );
}
else 
{
 digitalWrite ( RELAY2, LOW );
}
}

You also never call the fanTimer function in your code. Try

#include <Time.h>
#include <Wire.h>
#include <DS3231RTC.h> // A simple DS3231 Library meant for use with Time.h also implements temp readings
 
const int RELAY1 = 22;
const int RELAY2 = 23;
const int RELAY3 = 24;
const int RELAY4 = 25;


void setup() {
 Serial.begin(9600);
 setTime(10,1,0,9,14,16);
}
 
void loop()
{
 fanTimer(); //add call to function
 digitalClockDisplay();
 delay(1000);
}
 
void digitalClockDisplay(){
 // digital clock display of the time
 Serial.print(hour());
 printDigits(minute());
 printDigits(second());
 Serial.print(" ");
 Serial.print(day());
 Serial.print(" ");
 Serial.print(month());
 Serial.print(" ");
 Serial.print(year());
 Serial.print(" ");
 Serial.print(RTC.getTemp()); //These last few lines are the only other change to the the Time.h example!
 Serial.print((char)223);
 Serial.print('C');
 Serial.println();
}
 
void printDigits(int digits){
 // utility function for digital clock display: prints preceding colon and leading 0
 Serial.print(":");
 if(digits < 10)
 Serial.print('0');
 Serial.print(digits);
}

void fanTimer(){
      if ( minute() >= 0 && minute() < 5)  //correct syntax for minute()
{
  digitalWrite ( RELAY2, HIGH );
}
else 
{
 digitalWrite ( RELAY2, LOW );
}
}